diff options
Diffstat (limited to 'Build/source/texk')
28 files changed, 1034 insertions, 1028 deletions
diff --git a/Build/source/texk/kpathsea/ChangeLog b/Build/source/texk/kpathsea/ChangeLog index 6e779ac13cc..7029c47b081 100644 --- a/Build/source/texk/kpathsea/ChangeLog +++ b/Build/source/texk/kpathsea/ChangeLog @@ -1,3 +1,12 @@ +2010-05-16 Akira Kakuto <kakuto@fuk.kindai.ac.jp> + + *absolute.c, c-fopen.h, c-stat.h, config.h, debug.h, dir.c, + elt-dirs.c, expand.c, getopt.c, getopt.h, getopt1.c, hash.c, + kpsewhich.c, lib.h, mingw32.c, path-elt.c, pathsearch.c, + progname.c, putenv.c, readable.c, strcasecmp.c, strstr.c, + strtol.c, tex-file.c, tex-glyph.h, + types.h, win32lib.h: untabify. + 2010-05-15 Akira Kakuto <kakuto@fuk.kindai.ac.jp> *absolute.c: avoid late declaration. add support of UNC names (WIN32). diff --git a/Build/source/texk/kpathsea/absolute.c b/Build/source/texk/kpathsea/absolute.c index cae7363148d..2afc4577ed0 100644 --- a/Build/source/texk/kpathsea/absolute.c +++ b/Build/source/texk/kpathsea/absolute.c @@ -47,10 +47,10 @@ kpathsea_absolute_p (kpathsea kpse, const_string filename, boolean relative_ok) || (*filename == '/' && filename[1] == '/') #endif #ifdef AMIGA - /* Colon anywhere means a device. */ - || strchr (filename, ':') + /* Colon anywhere means a device. */ + || strchr (filename, ':') #endif /* AMIGA */ - ; + ; explicit_relative = relative_ok #ifdef AMIGA diff --git a/Build/source/texk/kpathsea/c-fopen.h b/Build/source/texk/kpathsea/c-fopen.h index 3ae1f911f48..77980570bd2 100644 --- a/Build/source/texk/kpathsea/c-fopen.h +++ b/Build/source/texk/kpathsea/c-fopen.h @@ -34,7 +34,7 @@ /* How to open a binary file for reading: */ #ifndef FOPEN_RBIN_MODE -#define FOPEN_RBIN_MODE "rb" +#define FOPEN_RBIN_MODE "rb" #endif /* not FOPEN_RBIN_MODE */ /* How to open a binary file for writing: */ diff --git a/Build/source/texk/kpathsea/c-stat.h b/Build/source/texk/kpathsea/c-stat.h index d222fd8de01..084c3a32624 100644 --- a/Build/source/texk/kpathsea/c-stat.h +++ b/Build/source/texk/kpathsea/c-stat.h @@ -25,25 +25,25 @@ /* POSIX predicates for testing file attributes. */ #if !defined (S_ISBLK) && defined (S_IFBLK) -#define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK) +#define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK) #endif #if !defined (S_ISCHR) && defined (S_IFCHR) -#define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR) +#define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR) #endif #if !defined (S_ISDIR) && defined (S_IFDIR) -#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) +#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) #endif #if !defined (S_ISREG) && defined (S_IFREG) -#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) +#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) #endif #if !defined (S_ISFIFO) && defined (S_IFIFO) -#define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO) +#define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO) #endif #if !defined (S_ISLNK) && defined (S_IFLNK) -#define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK) +#define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK) #endif #if !defined (S_ISSOCK) && defined (S_IFSOCK) -#define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK) +#define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK) #endif #if !defined (S_ISMPB) && defined (S_IFMPB) /* V7 */ #define S_ISMPB(m) (((m) & S_IFMT) == S_IFMPB) diff --git a/Build/source/texk/kpathsea/config.h b/Build/source/texk/kpathsea/config.h index 374eb3b5bac..fdd7f81bf93 100644 --- a/Build/source/texk/kpathsea/config.h +++ b/Build/source/texk/kpathsea/config.h @@ -62,9 +62,9 @@ #include <kpathsea/c-auto.h> #ifdef __DJGPP__ -#include <fcntl.h> /* for long filenames' stuff */ -#include <dir.h> /* for `getdisk' */ -#include <io.h> /* for `setmode' */ +#include <fcntl.h> /* for long filenames' stuff */ +#include <dir.h> /* for `getdisk' */ +#include <io.h> /* for `setmode' */ #endif /* Some drivers have partially integrated kpathsea changes. */ diff --git a/Build/source/texk/kpathsea/debug.h b/Build/source/texk/kpathsea/debug.h index 45180646c12..bb0ab7fbc1c 100644 --- a/Build/source/texk/kpathsea/debug.h +++ b/Build/source/texk/kpathsea/debug.h @@ -65,28 +65,28 @@ #endif /* KPSE_COMPAT_API */ -#define KPSE_DEBUG_STAT 0 /* stat calls */ -#define KPSE_DEBUG_HASH 1 /* hash lookups */ -#define KPSE_DEBUG_FOPEN 2 /* fopen/fclose calls */ -#define KPSE_DEBUG_PATHS 3 /* search path initializations */ -#define KPSE_DEBUG_EXPAND 4 /* path element expansion */ -#define KPSE_DEBUG_SEARCH 5 /* searches */ -#define KPSE_DEBUG_VARS 6 /* variable values */ +#define KPSE_DEBUG_STAT 0 /* stat calls */ +#define KPSE_DEBUG_HASH 1 /* hash lookups */ +#define KPSE_DEBUG_FOPEN 2 /* fopen/fclose calls */ +#define KPSE_DEBUG_PATHS 3 /* search path initializations */ +#define KPSE_DEBUG_EXPAND 4 /* path element expansion */ +#define KPSE_DEBUG_SEARCH 5 /* searches */ +#define KPSE_DEBUG_VARS 6 /* variable values */ #define KPSE_LAST_DEBUG KPSE_DEBUG_VARS /* A printf for the debugging. */ #define DEBUGF_START() do { fputs ("kdebug:", stderr) #define DEBUGF_END() fflush (stderr); } while (0) -#define DEBUGF(str) \ +#define DEBUGF(str) \ DEBUGF_START (); fputs (str, stderr); DEBUGF_END () -#define DEBUGF1(str, e1) \ +#define DEBUGF1(str, e1) \ DEBUGF_START (); fprintf (stderr, str, e1); DEBUGF_END () -#define DEBUGF2(str, e1, e2) \ +#define DEBUGF2(str, e1, e2) \ DEBUGF_START (); fprintf (stderr, str, e1, e2); DEBUGF_END () -#define DEBUGF3(str, e1, e2, e3) \ +#define DEBUGF3(str, e1, e2, e3) \ DEBUGF_START (); fprintf (stderr, str, e1, e2, e3); DEBUGF_END () -#define DEBUGF4(str, e1, e2, e3, e4) \ +#define DEBUGF4(str, e1, e2, e3, e4) \ DEBUGF_START (); fprintf (stderr, str, e1, e2, e3, e4); DEBUGF_END () #undef fopen diff --git a/Build/source/texk/kpathsea/dir.c b/Build/source/texk/kpathsea/dir.c index 9e3e83fabbd..37a556b343c 100644 --- a/Build/source/texk/kpathsea/dir.c +++ b/Build/source/texk/kpathsea/dir.c @@ -30,8 +30,8 @@ boolean kpathsea_dir_p (kpathsea kpse, const_string fn) { /* FIXME : using the stat() replacement in gnuw32, - we could avoid this win32 specific code. However, - I wonder if it would be as fast as this one is ? + we could avoid this win32 specific code. However, + I wonder if it would be as fast as this one is ? */ #ifdef WIN32 int fa; @@ -43,11 +43,11 @@ kpathsea_dir_p (kpathsea kpse, const_string fn) if (KPATHSEA_DEBUG_P (KPSE_DEBUG_STAT)) { if (fa == 0xFFFFFFFF) { fprintf(stderr, "failed to get file attributes for %s (%d)\n", - fn, (int)(GetLastError())); + fn, (int)(GetLastError())); } else { fprintf(stderr, "path %s %s a directory\n", - fn , (fa & FILE_ATTRIBUTE_DIRECTORY) ? - "is" : "is not"); + fn , (fa & FILE_ATTRIBUTE_DIRECTORY) ? + "is" : "is not"); } } #endif /* KPSE_DEBUG */ @@ -144,5 +144,3 @@ dir_links (const_string fn, long nlinks) return kpathsea_dir_links(kpse_def, fn, nlinks); } #endif - - diff --git a/Build/source/texk/kpathsea/elt-dirs.c b/Build/source/texk/kpathsea/elt-dirs.c index d245e9483ef..c9ad0aaffaf 100644 --- a/Build/source/texk/kpathsea/elt-dirs.c +++ b/Build/source/texk/kpathsea/elt-dirs.c @@ -158,17 +158,17 @@ do_subdir (kpathsea kpse, str_llist_type *str_list_ptr, const_string elt, fn_str_grow (&name, find_file_data.cFileName); /* Maybe we have cached the leafness of this directory. - The function will return 0 if unknown, - else the actual (Unix-like) value. */ + The function will return 0 if unknown, + else the actual (Unix-like) value. */ links = kpathsea_dir_links (kpse, FN_STRING (name), 0); if (find_file_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { - unsigned potential_len = FN_LENGTH (name); - /* in any case, compute the leafness */ - nlinks++; + unsigned potential_len = FN_LENGTH (name); + /* in any case, compute the leafness */ + nlinks++; - /* It's a directory, so append the separator. */ - fn_str_grow (&name, DIR_SEP_STRING); + /* It's a directory, so append the separator. */ + fn_str_grow (&name, DIR_SEP_STRING); if (*post != 0) { fn_str_grow (&name, post); /* Unfortunately we can't check if the new element is @@ -179,21 +179,21 @@ do_subdir (kpathsea kpse, str_llist_type *str_list_ptr, const_string elt, expand_elt (kpse, str_list_ptr, FN_STRING (name), potential_len); fn_shrink_to (&name, potential_len); } - /* Should we recurse? To see if the subdirectory is a - leaf, check if it has two links (one for . and one for - ..). This means that symbolic links to directories do - not affect the leaf-ness. This is arguably wrong, but - the only alternative I know of is to stat every entry - in the directory, and that is unacceptably slow. */ - - if (links == 0 || links > 2) - /* All criteria are met; find subdirectories. */ + /* Should we recurse? To see if the subdirectory is a + leaf, check if it has two links (one for . and one for + ..). This means that symbolic links to directories do + not affect the leaf-ness. This is arguably wrong, but + the only alternative I know of is to stat every entry + in the directory, and that is unacceptably slow. */ + + if (links == 0 || links > 2) + /* All criteria are met; find subdirectories. */ do_subdir (kpse, str_list_ptr, FN_STRING (name), - potential_len, post); - else if (*post == 0) - /* Nothing to match, no recursive subdirectories to - look for: we're done with this branch. Add it. */ - dir_list_add (str_list_ptr, FN_STRING (name)); + potential_len, post); + else if (*post == 0) + /* Nothing to match, no recursive subdirectories to + look for: we're done with this branch. Add it. */ + dir_list_add (str_list_ptr, FN_STRING (name)); } fn_shrink_to (&name, elt_length); } @@ -317,9 +317,9 @@ expand_elt (kpathsea kpse, str_llist_type * str_list_ptr, const_string elt, /* If two or more consecutive /'s, find subdirectories. */ if (IS_DIR_SEP (dir[1])) { - for (post = dir + 1; IS_DIR_SEP (*post); post++) ; + for (post = dir + 1; IS_DIR_SEP (*post); post++) ; do_subdir (kpse, str_list_ptr, elt, dir - elt + 1, post); - return; + return; } /* No special stuff at this slash. Keep going. */ @@ -478,25 +478,25 @@ main () { /* DEBUG_SET (DEBUG_STAT); */ /* All lists end with NULL. */ - print_element_dirs (NULL); /* */ - print_element_dirs (""); /* ./ */ - print_element_dirs ("/k"); /* */ - print_element_dirs (".//"); /* ./ ./archive/ */ - print_element_dirs (".//archive"); /* ./ ./archive/ */ + print_element_dirs (NULL); /* */ + print_element_dirs (""); /* ./ */ + print_element_dirs ("/k"); /* */ + print_element_dirs (".//"); /* ./ ./archive/ */ + print_element_dirs (".//archive"); /* ./ ./archive/ */ #ifdef AMIGA print_element_dirs ("TeXMF:AmiWeb2c/texmf/fonts//"); /* lots */ print_element_dirs ("TeXMF:AmiWeb2c/share/texmf/fonts//bakoma"); /*just one*/ print_element_dirs ("TeXMF:AmiWeb2c/texmf/fonts//"); /* lots again [cache] */ - print_element_dirs ("TeXMF:"); /* TeXMF: */ - print_element_dirs ("TeXMF:/"); /* TeXMF: and all subdirs */ + print_element_dirs ("TeXMF:"); /* TeXMF: */ + print_element_dirs ("TeXMF:/"); /* TeXMF: and all subdirs */ #else /* not AMIGA */ - print_element_dirs ("/tmp/fonts//"); /* no need to stat anything */ + print_element_dirs ("/tmp/fonts//"); /* no need to stat anything */ print_element_dirs ("/usr/local/lib/tex/fonts//"); /* lots */ print_element_dirs ("/usr/local/lib/tex/fonts//times"); /* just one */ print_element_dirs ("/usr/local/lib/tex/fonts//"); /* lots again [cache] */ - print_element_dirs ("~karl"); /* tilde expansion */ - print_element_dirs ("$karl"); /* variable expansion */ - print_element_dirs ("~${LOGNAME}"); /* both */ + print_element_dirs ("~karl"); /* tilde expansion */ + print_element_dirs ("$karl"); /* variable expansion */ + print_element_dirs ("~${LOGNAME}"); /* both */ #endif /* not AMIGA */ return 0; } diff --git a/Build/source/texk/kpathsea/expand.c b/Build/source/texk/kpathsea/expand.c index 232a1245a48..895a627b510 100644 --- a/Build/source/texk/kpathsea/expand.c +++ b/Build/source/texk/kpathsea/expand.c @@ -368,15 +368,15 @@ main (int argc, char **argv) fprintf (stderr, "brace_expand> "); if ((!fgets (example, 256, stdin)) || - (strncmp (example, "quit", 4) == 0)) - break; + (strncmp (example, "quit", 4) == 0)) + break; if (strlen (example)) - example[strlen (example) - 1] = 0; + example[strlen (example) - 1] = 0; result = kpse_brace_expand (example); - printf ("%s\n", result); + printf ("%s\n", result); } } diff --git a/Build/source/texk/kpathsea/getopt.c b/Build/source/texk/kpathsea/getopt.c index 3550e933848..e8236a71b92 100644 --- a/Build/source/texk/kpathsea/getopt.c +++ b/Build/source/texk/kpathsea/getopt.c @@ -2,7 +2,7 @@ Copyright 2008, 2009, 2010 Karl Berry. Copyright (C) 1987, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 2000, 2010 - Free Software Foundation, Inc. + Free Software Foundation, Inc. The original version of this file was part of the GNU C Library. Its master source is NOT part of the C library, however. @@ -56,12 +56,12 @@ /* This needs to come after some library #include to get __GNU_LIBRARY__ defined. */ -#ifdef __GNU_LIBRARY__ +#ifdef __GNU_LIBRARY__ /* Don't include stdlib.h for non-GNU C libraries because some of them contain conflicting prototypes for getopt. */ #include <stdlib.h> #include <unistd.h> -#endif /* GNU C library. */ +#endif /* GNU C library. */ #ifdef VMS #include <unixlib.h> @@ -85,9 +85,9 @@ When compiling libc, the _ macro is predefined. */ #ifdef HAVE_LIBINTL_H # include <libintl.h> -# define _(msgid) gettext (msgid) +# define _(msgid) gettext (msgid) #else -# define _(msgid) (msgid) +# define _(msgid) (msgid) #endif #endif @@ -199,7 +199,7 @@ static char *posixly_correct; On some systems, it contains special magic macros that don't work in GCC. */ #include <string.h> -#define my_index strchr +#define my_index strchr #else /* Avoid depending on library functions or files @@ -212,7 +212,7 @@ static char *my_index(const char *str, int chr) while (*str) { if (*str == chr) - return (char *) str; + return (char *) str; str++; } return 0; @@ -290,37 +290,37 @@ static void exchange(char **argv) while (top > middle && middle > bottom) { if (top - middle > middle - bottom) - { - /* Bottom segment is the short one. */ - int len = middle - bottom; - register int i; - - /* Swap it with the top part of the top segment. */ - for (i = 0; i < len; i++) - { - tem = argv[bottom + i]; - argv[bottom + i] = argv[top - (middle - bottom) + i]; - argv[top - (middle - bottom) + i] = tem; - } - /* Exclude the moved bottom segment from further swapping. */ - top -= len; - } + { + /* Bottom segment is the short one. */ + int len = middle - bottom; + register int i; + + /* Swap it with the top part of the top segment. */ + for (i = 0; i < len; i++) + { + tem = argv[bottom + i]; + argv[bottom + i] = argv[top - (middle - bottom) + i]; + argv[top - (middle - bottom) + i] = tem; + } + /* Exclude the moved bottom segment from further swapping. */ + top -= len; + } else - { - /* Top segment is the short one. */ - int len = top - middle; - register int i; - - /* Swap it with the bottom part of the bottom segment. */ - for (i = 0; i < len; i++) - { - tem = argv[bottom + i]; - argv[bottom + i] = argv[middle + i]; - argv[middle + i] = tem; - } - /* Exclude the moved top segment from further swapping. */ - bottom += len; - } + { + /* Top segment is the short one. */ + int len = top - middle; + register int i; + + /* Swap it with the bottom part of the bottom segment. */ + for (i = 0; i < len; i++) + { + tem = argv[bottom + i]; + argv[bottom + i] = argv[middle + i]; + argv[middle + i] = tem; + } + /* Exclude the moved top segment from further swapping. */ + bottom += len; + } } /* Update records for the slots the non-options now occupy. */ @@ -365,16 +365,16 @@ static const char *_getopt_initialize(int argc, char *const *argv, const char *o && argc == original_argc && argv == original_argv) { /* Bash 2.0 puts a special variable in the environment for each - command it runs, specifying which ARGV elements are the results of - file name wildcard expansion and therefore should not be - considered as options. */ + command it runs, specifying which ARGV elements are the results of + file name wildcard expansion and therefore should not be + considered as options. */ char var[100]; sprintf (var, "_%d_GNU_nonoption_argv_flags_", getpid ()); nonoption_flags = getenv (var); if (nonoption_flags == NULL) - nonoption_flags_len = 0; + nonoption_flags_len = 0; else - nonoption_flags_len = strlen (nonoption_flags); + nonoption_flags_len = strlen (nonoption_flags); } else nonoption_flags_len = 0; @@ -452,7 +452,7 @@ int _getopt_internal( if (!__getopt_initialized || optind == 0) { optstring = _getopt_initialize (argc, argv, optstring); - optind = 1; /* Don't scan ARGV[0], the program name. */ + optind = 1; /* Don't scan ARGV[0], the program name. */ __getopt_initialized = 1; } @@ -461,9 +461,9 @@ int _getopt_internal( from the shell indicating it is not an option. The later information is only used when the used in the GNU libc. */ #ifdef _LIBC -#define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0' \ - || (optind < nonoption_flags_len \ - && nonoption_flags[optind] == '1')) +#define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0' \ + || (optind < nonoption_flags_len \ + && nonoption_flags[optind] == '1')) #else #define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0') #endif @@ -473,76 +473,76 @@ int _getopt_internal( /* Advance to the next ARGV-element. */ /* Give FIRST_NONOPT & LAST_NONOPT rational values if OPTIND has been - moved back by the user (who may also have changed the arguments). */ + moved back by the user (who may also have changed the arguments). */ if (last_nonopt > optind) - last_nonopt = optind; + last_nonopt = optind; if (first_nonopt > optind) - first_nonopt = optind; + first_nonopt = optind; if (ordering == PERMUTE) - { - /* If we have just processed some options following some non-options, - exchange them so that the options come first. */ + { + /* If we have just processed some options following some non-options, + exchange them so that the options come first. */ - if (first_nonopt != last_nonopt && last_nonopt != optind) - exchange ((char **) argv); - else if (last_nonopt != optind) - first_nonopt = optind; + if (first_nonopt != last_nonopt && last_nonopt != optind) + exchange ((char **) argv); + else if (last_nonopt != optind) + first_nonopt = optind; - /* Skip any additional non-options - and extend the range of non-options previously skipped. */ + /* Skip any additional non-options + and extend the range of non-options previously skipped. */ - while (optind < argc && NONOPTION_P) - optind++; - last_nonopt = optind; - } + while (optind < argc && NONOPTION_P) + optind++; + last_nonopt = optind; + } /* The special ARGV-element `--' means premature end of options. - Skip it like a null option, - then exchange with previous non-options as if it were an option, - then skip everything else like a non-option. */ + Skip it like a null option, + then exchange with previous non-options as if it were an option, + then skip everything else like a non-option. */ if (optind != argc && !strcmp (argv[optind], "--")) - { - optind++; + { + optind++; - if (first_nonopt != last_nonopt && last_nonopt != optind) - exchange ((char **) argv); - else if (first_nonopt == last_nonopt) - first_nonopt = optind; - last_nonopt = argc; + if (first_nonopt != last_nonopt && last_nonopt != optind) + exchange ((char **) argv); + else if (first_nonopt == last_nonopt) + first_nonopt = optind; + last_nonopt = argc; - optind = argc; - } + optind = argc; + } /* If we have done all the ARGV-elements, stop the scan - and back over any non-options that we skipped and permuted. */ + and back over any non-options that we skipped and permuted. */ if (optind == argc) - { - /* Set the next-arg-index to point at the non-options - that we previously skipped, so the caller will digest them. */ - if (first_nonopt != last_nonopt) - optind = first_nonopt; - return -1; - } + { + /* Set the next-arg-index to point at the non-options + that we previously skipped, so the caller will digest them. */ + if (first_nonopt != last_nonopt) + optind = first_nonopt; + return -1; + } /* If we have come to a non-option and did not permute it, - either stop the scan or describe it to the caller and pass it by. */ + either stop the scan or describe it to the caller and pass it by. */ if (NONOPTION_P) - { - if (ordering == REQUIRE_ORDER) - return -1; - optarg = argv[optind++]; - return 1; - } + { + if (ordering == REQUIRE_ORDER) + return -1; + optarg = argv[optind++]; + return 1; + } /* We have found another option-ARGV-element. - Skip the initial punctuation. */ + Skip the initial punctuation. */ nextchar = (argv[optind] + 1 - + (longopts != NULL && argv[optind][1] == '-')); + + (longopts != NULL && argv[optind][1] == '-')); } /* Decode the current option-ARGV-element. */ @@ -562,7 +562,7 @@ int _getopt_internal( if (longopts != NULL && (argv[optind][1] == '-' - || (long_only && (argv[optind][2] || !my_index (optstring, argv[optind][1]))))) + || (long_only && (argv[optind][2] || !my_index (optstring, argv[optind][1]))))) { char *nameend; const struct option *p; @@ -573,125 +573,125 @@ int _getopt_internal( int option_index; for (nameend = nextchar; *nameend && *nameend != '='; nameend++) - /* Do nothing. */ ; + /* Do nothing. */ ; /* Test all long options for either exact match - or abbreviated matches. */ + or abbreviated matches. */ for (p = longopts, option_index = 0; p->name; p++, option_index++) - if (!strncmp (p->name, nextchar, nameend - nextchar)) - { - if ((unsigned int) (nameend - nextchar) - == (unsigned int) strlen (p->name)) - { - /* Exact match found. */ - pfound = p; - indfound = option_index; - exact = 1; - break; - } - else if (pfound == NULL) - { - /* First nonexact match found. */ - pfound = p; - indfound = option_index; - } - else - /* Second or later nonexact match found. */ - ambig = 1; - } + if (!strncmp (p->name, nextchar, nameend - nextchar)) + { + if ((unsigned int) (nameend - nextchar) + == (unsigned int) strlen (p->name)) + { + /* Exact match found. */ + pfound = p; + indfound = option_index; + exact = 1; + break; + } + else if (pfound == NULL) + { + /* First nonexact match found. */ + pfound = p; + indfound = option_index; + } + else + /* Second or later nonexact match found. */ + ambig = 1; + } if (ambig && !exact) - { - if (opterr) - fprintf (stderr, _("%s: option `%s' is ambiguous\n"), - argv[0], argv[optind]); - nextchar += strlen (nextchar); - optind++; - optopt = 0; - return '?'; - } + { + if (opterr) + fprintf (stderr, _("%s: option `%s' is ambiguous\n"), + argv[0], argv[optind]); + nextchar += strlen (nextchar); + optind++; + optopt = 0; + return '?'; + } if (pfound != NULL) - { - option_index = indfound; - optind++; - if (*nameend) - { - /* Don't test has_arg with >, because some C compilers don't - allow it to be used on enums. */ - if (pfound->has_arg) - optarg = nameend + 1; - else - { - if (opterr) - { - if (argv[optind - 1][1] == '-') - /* --option */ - fprintf (stderr, - _("%s: option `--%s' doesn't allow an argument\n"), - argv[0], pfound->name); - else - /* +option or -option */ - fprintf (stderr, - _("%s: option `%c%s' doesn't allow an argument\n"), - argv[0], argv[optind - 1][0], pfound->name); - } - - nextchar += strlen (nextchar); - - optopt = pfound->val; - return '?'; - } - } - else if (pfound->has_arg == 1) - { - if (optind < argc) - optarg = argv[optind++]; - else - { - if (opterr) - fprintf (stderr, - _("%s: option `%s' requires an argument\n"), - argv[0], argv[optind - 1]); - nextchar += strlen (nextchar); - optopt = pfound->val; - return optstring[0] == ':' ? ':' : '?'; - } - } - nextchar += strlen (nextchar); - if (longind != NULL) - *longind = option_index; - if (pfound->flag) - { - *(pfound->flag) = pfound->val; - return 0; - } - return pfound->val; - } + { + option_index = indfound; + optind++; + if (*nameend) + { + /* Don't test has_arg with >, because some C compilers don't + allow it to be used on enums. */ + if (pfound->has_arg) + optarg = nameend + 1; + else + { + if (opterr) + { + if (argv[optind - 1][1] == '-') + /* --option */ + fprintf (stderr, + _("%s: option `--%s' doesn't allow an argument\n"), + argv[0], pfound->name); + else + /* +option or -option */ + fprintf (stderr, + _("%s: option `%c%s' doesn't allow an argument\n"), + argv[0], argv[optind - 1][0], pfound->name); + } + + nextchar += strlen (nextchar); + + optopt = pfound->val; + return '?'; + } + } + else if (pfound->has_arg == 1) + { + if (optind < argc) + optarg = argv[optind++]; + else + { + if (opterr) + fprintf (stderr, + _("%s: option `%s' requires an argument\n"), + argv[0], argv[optind - 1]); + nextchar += strlen (nextchar); + optopt = pfound->val; + return optstring[0] == ':' ? ':' : '?'; + } + } + nextchar += strlen (nextchar); + if (longind != NULL) + *longind = option_index; + if (pfound->flag) + { + *(pfound->flag) = pfound->val; + return 0; + } + return pfound->val; + } /* Can't find it as a long option. If this is not getopt_long_only, - or the option starts with '--' or is not a valid short - option, then it's an error. - Otherwise interpret it as a short option. */ + or the option starts with '--' or is not a valid short + option, then it's an error. + Otherwise interpret it as a short option. */ if (!long_only || argv[optind][1] == '-' - || my_index (optstring, *nextchar) == NULL) - { - if (opterr) - { - if (argv[optind][1] == '-') - /* --option */ - fprintf (stderr, _("%s: unrecognized option `--%s'\n"), - argv[0], nextchar); - else - /* +option or -option */ - fprintf (stderr, _("%s: unrecognized option `%c%s'\n"), - argv[0], argv[optind][0], nextchar); - } - nextchar = (char *) ""; - optind++; - optopt = 0; - return '?'; - } + || my_index (optstring, *nextchar) == NULL) + { + if (opterr) + { + if (argv[optind][1] == '-') + /* --option */ + fprintf (stderr, _("%s: unrecognized option `--%s'\n"), + argv[0], nextchar); + else + /* +option or -option */ + fprintf (stderr, _("%s: unrecognized option `%c%s'\n"), + argv[0], argv[optind][0], nextchar); + } + nextchar = (char *) ""; + optind++; + optopt = 0; + return '?'; + } } /* Look at and handle the next short option-character. */ @@ -706,188 +706,188 @@ int _getopt_internal( if (temp == NULL || c == ':') { - if (opterr) - { - if (posixly_correct) - /* 1003.2 specifies the format of this message. */ - fprintf (stderr, _("%s: illegal option -- %c\n"), - argv[0], c); - else - fprintf (stderr, _("%s: invalid option -- %c\n"), - argv[0], c); - } - optopt = c; - return '?'; + if (opterr) + { + if (posixly_correct) + /* 1003.2 specifies the format of this message. */ + fprintf (stderr, _("%s: illegal option -- %c\n"), + argv[0], c); + else + fprintf (stderr, _("%s: invalid option -- %c\n"), + argv[0], c); + } + optopt = c; + return '?'; } /* Convenience. Treat POSIX -W foo same as long option --foo */ if (temp[0] == 'W' && temp[1] == ';') { - char *nameend; - const struct option *p; - const struct option *pfound = NULL; - int exact = 0; - int ambig = 0; - int indfound = 0; - int option_index; - - /* This is an option that requires an argument. */ - if (*nextchar != '\0') - { - optarg = nextchar; - /* If we end this ARGV-element by taking the rest as an arg, - we must advance to the next element now. */ - optind++; - } - else if (optind == argc) - { - if (opterr) - { - /* 1003.2 specifies the format of this message. */ - fprintf (stderr, _("%s: option requires an argument -- %c\n"), - argv[0], c); - } - optopt = c; - if (optstring[0] == ':') - c = ':'; - else - c = '?'; - return c; - } - else - /* We already incremented `optind' once; - increment it again when taking next ARGV-elt as argument. */ - optarg = argv[optind++]; - - /* optarg is now the argument, see if it's in the - table of longopts. */ - - for (nextchar = nameend = optarg; *nameend && *nameend != '='; nameend++) - /* Do nothing. */ ; - - /* Test all long options for either exact match - or abbreviated matches. */ - for (p = longopts, option_index = 0; p->name; p++, option_index++) - if (!strncmp (p->name, nextchar, nameend - nextchar)) - { - if ((unsigned int) (nameend - nextchar) == strlen (p->name)) - { - /* Exact match found. */ - pfound = p; - indfound = option_index; - exact = 1; - break; - } - else if (pfound == NULL) - { - /* First nonexact match found. */ - pfound = p; - indfound = option_index; - } - else - /* Second or later nonexact match found. */ - ambig = 1; - } - if (ambig && !exact) - { - if (opterr) - fprintf (stderr, _("%s: option `-W %s' is ambiguous\n"), - argv[0], argv[optind]); - nextchar += strlen (nextchar); - optind++; - return '?'; - } - if (pfound != NULL) - { - option_index = indfound; - if (*nameend) - { - /* Don't test has_arg with >, because some C compilers don't - allow it to be used on enums. */ - if (pfound->has_arg) - optarg = nameend + 1; - else - { - if (opterr) - fprintf (stderr, _("\ + char *nameend; + const struct option *p; + const struct option *pfound = NULL; + int exact = 0; + int ambig = 0; + int indfound = 0; + int option_index; + + /* This is an option that requires an argument. */ + if (*nextchar != '\0') + { + optarg = nextchar; + /* If we end this ARGV-element by taking the rest as an arg, + we must advance to the next element now. */ + optind++; + } + else if (optind == argc) + { + if (opterr) + { + /* 1003.2 specifies the format of this message. */ + fprintf (stderr, _("%s: option requires an argument -- %c\n"), + argv[0], c); + } + optopt = c; + if (optstring[0] == ':') + c = ':'; + else + c = '?'; + return c; + } + else + /* We already incremented `optind' once; + increment it again when taking next ARGV-elt as argument. */ + optarg = argv[optind++]; + + /* optarg is now the argument, see if it's in the + table of longopts. */ + + for (nextchar = nameend = optarg; *nameend && *nameend != '='; nameend++) + /* Do nothing. */ ; + + /* Test all long options for either exact match + or abbreviated matches. */ + for (p = longopts, option_index = 0; p->name; p++, option_index++) + if (!strncmp (p->name, nextchar, nameend - nextchar)) + { + if ((unsigned int) (nameend - nextchar) == strlen (p->name)) + { + /* Exact match found. */ + pfound = p; + indfound = option_index; + exact = 1; + break; + } + else if (pfound == NULL) + { + /* First nonexact match found. */ + pfound = p; + indfound = option_index; + } + else + /* Second or later nonexact match found. */ + ambig = 1; + } + if (ambig && !exact) + { + if (opterr) + fprintf (stderr, _("%s: option `-W %s' is ambiguous\n"), + argv[0], argv[optind]); + nextchar += strlen (nextchar); + optind++; + return '?'; + } + if (pfound != NULL) + { + option_index = indfound; + if (*nameend) + { + /* Don't test has_arg with >, because some C compilers don't + allow it to be used on enums. */ + if (pfound->has_arg) + optarg = nameend + 1; + else + { + if (opterr) + fprintf (stderr, _("\ %s: option `-W %s' doesn't allow an argument\n"), - argv[0], pfound->name); - - nextchar += strlen (nextchar); - return '?'; - } - } - else if (pfound->has_arg == 1) - { - if (optind < argc) - optarg = argv[optind++]; - else - { - if (opterr) - fprintf (stderr, - _("%s: option `%s' requires an argument\n"), - argv[0], argv[optind - 1]); - nextchar += strlen (nextchar); - return optstring[0] == ':' ? ':' : '?'; - } - } - nextchar += strlen (nextchar); - if (longind != NULL) - *longind = option_index; - if (pfound->flag) - { - *(pfound->flag) = pfound->val; - return 0; - } - return pfound->val; - } - nextchar = NULL; - return 'W'; /* Let the application handle it. */ + argv[0], pfound->name); + + nextchar += strlen (nextchar); + return '?'; + } + } + else if (pfound->has_arg == 1) + { + if (optind < argc) + optarg = argv[optind++]; + else + { + if (opterr) + fprintf (stderr, + _("%s: option `%s' requires an argument\n"), + argv[0], argv[optind - 1]); + nextchar += strlen (nextchar); + return optstring[0] == ':' ? ':' : '?'; + } + } + nextchar += strlen (nextchar); + if (longind != NULL) + *longind = option_index; + if (pfound->flag) + { + *(pfound->flag) = pfound->val; + return 0; + } + return pfound->val; + } + nextchar = NULL; + return 'W'; /* Let the application handle it. */ } if (temp[1] == ':') { - if (temp[2] == ':') - { - /* This is an option that accepts an argument optionally. */ - if (*nextchar != '\0') - { - optarg = nextchar; - optind++; - } - else - optarg = NULL; - nextchar = NULL; - } - else - { - /* This is an option that requires an argument. */ - if (*nextchar != '\0') - { - optarg = nextchar; - /* If we end this ARGV-element by taking the rest as an arg, - we must advance to the next element now. */ - optind++; - } - else if (optind == argc) - { - if (opterr) - { - /* 1003.2 specifies the format of this message. */ - fprintf (stderr, - _("%s: option requires an argument -- %c\n"), - argv[0], c); - } - optopt = c; - if (optstring[0] == ':') - c = ':'; - else - c = '?'; - } - else - /* We already incremented `optind' once; - increment it again when taking next ARGV-elt as argument. */ - optarg = argv[optind++]; - nextchar = NULL; - } + if (temp[2] == ':') + { + /* This is an option that accepts an argument optionally. */ + if (*nextchar != '\0') + { + optarg = nextchar; + optind++; + } + else + optarg = NULL; + nextchar = NULL; + } + else + { + /* This is an option that requires an argument. */ + if (*nextchar != '\0') + { + optarg = nextchar; + /* If we end this ARGV-element by taking the rest as an arg, + we must advance to the next element now. */ + optind++; + } + else if (optind == argc) + { + if (opterr) + { + /* 1003.2 specifies the format of this message. */ + fprintf (stderr, + _("%s: option requires an argument -- %c\n"), + argv[0], c); + } + optopt = c; + if (optstring[0] == ':') + c = ':'; + else + c = '?'; + } + else + /* We already incremented `optind' once; + increment it again when taking next ARGV-elt as argument. */ + optarg = argv[optind++]; + nextchar = NULL; + } } return c; } @@ -896,12 +896,12 @@ int _getopt_internal( int getopt(int argc, char *const *argv, const char *optstring) { return _getopt_internal (argc, argv, optstring, - (const struct option *) 0, - (int *) 0, - 0); + (const struct option *) 0, + (int *) 0, + 0); } -#endif /* Not ELIDE_CODE. */ +#endif /* Not ELIDE_CODE. */ #ifdef TEST @@ -919,51 +919,51 @@ int main(int argc, char **argv) c = getopt (argc, argv, "abc:d:0123456789"); if (c == -1) - break; + break; switch (c) - { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - if (digit_optind != 0 && digit_optind != this_option_optind) - printf ("digits occur in two different argv-elements.\n"); - digit_optind = this_option_optind; - printf ("option %c\n", c); - break; - - case 'a': - printf ("option a\n"); - break; - - case 'b': - printf ("option b\n"); - break; - - case 'c': - printf ("option c with value `%s'\n", optarg); - break; - - case '?': - break; - - default: - printf ("?? getopt returned character code 0%o ??\n", c); - } + { + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + if (digit_optind != 0 && digit_optind != this_option_optind) + printf ("digits occur in two different argv-elements.\n"); + digit_optind = this_option_optind; + printf ("option %c\n", c); + break; + + case 'a': + printf ("option a\n"); + break; + + case 'b': + printf ("option b\n"); + break; + + case 'c': + printf ("option c with value `%s'\n", optarg); + break; + + case '?': + break; + + default: + printf ("?? getopt returned character code 0%o ??\n", c); + } } if (optind < argc) { printf ("non-option ARGV-elements: "); while (optind < argc) - printf ("%s ", argv[optind++]); + printf ("%s ", argv[optind++]); printf ("\n"); } diff --git a/Build/source/texk/kpathsea/getopt.h b/Build/source/texk/kpathsea/getopt.h index 8df5003ac8e..945ea7775f3 100644 --- a/Build/source/texk/kpathsea/getopt.h +++ b/Build/source/texk/kpathsea/getopt.h @@ -38,7 +38,7 @@ #define KPSEDLL #endif -#ifdef __cplusplus +#ifdef __cplusplus extern "C" { #endif @@ -79,9 +79,9 @@ extern KPSEDLL int optopt; zero. The field `has_arg' is: - no_argument (or 0) if the option does not take an argument, - required_argument (or 1) if the option requires an argument, - optional_argument (or 2) if the option takes an optional argument. + no_argument (or 0) if the option does not take an argument, + required_argument (or 1) if the option requires an argument, + optional_argument (or 2) if the option takes an optional argument. If the field `flag' is not NULL, it points to a variable that is set to the value given in the field `val' when the option is found, but @@ -106,9 +106,9 @@ struct option /* Names for the values of the `has_arg' field of `struct option'. */ -#define no_argument 0 -#define required_argument 1 -#define optional_argument 2 +#define no_argument 0 +#define required_argument 1 +#define optional_argument 2 #if defined (__STDC__) && __STDC__ #ifdef __GNU_LIBRARY__ @@ -122,18 +122,18 @@ extern KPSEDLL int getopt (); #endif /* not __cplusplus */ #endif /* __GNU_LIBRARY__ */ extern KPSEDLL int getopt_long (int argc, char *const *argv, const char *shortopts, - const struct option *longopts, int *longind); + const struct option *longopts, int *longind); extern KPSEDLL int getopt_long_only (int argc, char *const *argv, - const char *shortopts, - const struct option *longopts, int *longind); + const char *shortopts, + const struct option *longopts, int *longind); #ifdef MAKE_KPSE_DLL /* libkpathsea internal only */ /* Internal only. Users should not call this directly. */ extern int _getopt_internal (int argc, char *const *argv, - const char *shortopts, - const struct option *longopts, int *longind, - int long_only); + const char *shortopts, + const struct option *longopts, int *longind, + int long_only); #endif /* MAKE_KPSE_DLL */ #else /* not __STDC__ */ @@ -148,7 +148,7 @@ extern int _getopt_internal (); #endif /* MAKE_KPSE_DLL */ #endif /* __STDC__ */ -#ifdef __cplusplus +#ifdef __cplusplus } #endif diff --git a/Build/source/texk/kpathsea/getopt1.c b/Build/source/texk/kpathsea/getopt1.c index 30cdf9a3506..f064984cdaa 100644 --- a/Build/source/texk/kpathsea/getopt1.c +++ b/Build/source/texk/kpathsea/getopt1.c @@ -83,7 +83,7 @@ int getopt_long_only( } -#endif /* Not ELIDE_CODE. */ +#endif /* Not ELIDE_CODE. */ #ifdef TEST @@ -100,74 +100,74 @@ int main(int argc, char **argv) int option_index = 0; static struct option long_options[] = { - {"add", 1, 0, 0}, - {"append", 0, 0, 0}, - {"delete", 1, 0, 0}, - {"verbose", 0, 0, 0}, - {"create", 0, 0, 0}, - {"file", 1, 0, 0}, - {0, 0, 0, 0} + {"add", 1, 0, 0}, + {"append", 0, 0, 0}, + {"delete", 1, 0, 0}, + {"verbose", 0, 0, 0}, + {"create", 0, 0, 0}, + {"file", 1, 0, 0}, + {0, 0, 0, 0} }; c = getopt_long (argc, argv, "abc:d:0123456789", - long_options, &option_index); + long_options, &option_index); if (c == -1) - break; + break; switch (c) - { - case 0: - printf ("option %s", long_options[option_index].name); - if (optarg) - printf (" with arg %s", optarg); - printf ("\n"); - break; - - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - if (digit_optind != 0 && digit_optind != this_option_optind) - printf ("digits occur in two different argv-elements.\n"); - digit_optind = this_option_optind; - printf ("option %c\n", c); - break; - - case 'a': - printf ("option a\n"); - break; - - case 'b': - printf ("option b\n"); - break; - - case 'c': - printf ("option c with value `%s'\n", optarg); - break; - - case 'd': - printf ("option d with value `%s'\n", optarg); - break; - - case '?': - break; - - default: - printf ("?? getopt returned character code 0%o ??\n", c); - } + { + case 0: + printf ("option %s", long_options[option_index].name); + if (optarg) + printf (" with arg %s", optarg); + printf ("\n"); + break; + + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + if (digit_optind != 0 && digit_optind != this_option_optind) + printf ("digits occur in two different argv-elements.\n"); + digit_optind = this_option_optind; + printf ("option %c\n", c); + break; + + case 'a': + printf ("option a\n"); + break; + + case 'b': + printf ("option b\n"); + break; + + case 'c': + printf ("option c with value `%s'\n", optarg); + break; + + case 'd': + printf ("option d with value `%s'\n", optarg); + break; + + case '?': + break; + + default: + printf ("?? getopt returned character code 0%o ??\n", c); + } } if (optind < argc) { printf ("non-option ARGV-elements: "); while (optind < argc) - printf ("%s ", argv[optind++]); + printf ("%s ", argv[optind++]); printf ("\n"); } diff --git a/Build/source/texk/kpathsea/hash.c b/Build/source/texk/kpathsea/hash.c index b3efad0fb4c..868e03893c4 100644 --- a/Build/source/texk/kpathsea/hash.c +++ b/Build/source/texk/kpathsea/hash.c @@ -105,9 +105,9 @@ hash_insert (hash_table_type *table, else { hash_element_type *loc = table->buckets[n]; - while (loc->next) /* Find the last element. */ + while (loc->next) /* Find the last element. */ loc = loc->next; - loc->next = new_elt; /* Insert the new one after. */ + loc->next = new_elt; /* Insert the new one after. */ } } @@ -131,9 +131,9 @@ hash_insert_normalized (hash_table_type *table, else { hash_element_type *loc = table->buckets[n]; - while (loc->next) /* Find the last element. */ + while (loc->next) /* Find the last element. */ loc = loc->next; - loc->next = new_elt; /* Insert the new one after. */ + loc->next = new_elt; /* Insert the new one after. */ } } diff --git a/Build/source/texk/kpathsea/kpsewhich.c b/Build/source/texk/kpathsea/kpsewhich.c index ee3d1904361..454f772b751 100644 --- a/Build/source/texk/kpathsea/kpsewhich.c +++ b/Build/source/texk/kpathsea/kpsewhich.c @@ -459,28 +459,28 @@ help_message (kpathsea kpse, string *argv) /* SunOS cc can't initialize automatic structs. */ static struct option long_options[] - = { { "D", 1, 0, 0 }, - { "all", 0, (int *) &show_all, 1 }, - { "debug", 1, 0, 0 }, - { "dpi", 1, 0, 0 }, - { "engine", 1, 0, 0 }, - { "expand-braces", 1, 0, 0 }, - { "expand-path", 1, 0, 0 }, - { "expand-var", 1, 0, 0 }, - { "format", 1, 0, 0 }, + = { { "D", 1, 0, 0 }, + { "all", 0, (int *) &show_all, 1 }, + { "debug", 1, 0, 0 }, + { "dpi", 1, 0, 0 }, + { "engine", 1, 0, 0 }, + { "expand-braces", 1, 0, 0 }, + { "expand-path", 1, 0, 0 }, + { "expand-var", 1, 0, 0 }, + { "format", 1, 0, 0 }, { "help", 0, 0, 0 }, - { "interactive", 0, (int *) &interactive, 1 }, - { "mktex", 1, 0, 0 }, - { "mode", 1, 0, 0 }, - { "must-exist", 0, (int *) &must_exist, 1 }, - { "path", 1, 0, 0 }, - { "no-mktex", 1, 0, 0 }, - { "progname", 1, 0, 0 }, - { "safe-in-name", 1, 0, 0 }, - { "safe-out-name", 1, 0, 0 }, - { "subdir", 1, 0, 0 }, - { "show-path", 1, 0, 0 }, - { "var-value", 1, 0, 0 }, + { "interactive", 0, (int *) &interactive, 1 }, + { "mktex", 1, 0, 0 }, + { "mode", 1, 0, 0 }, + { "must-exist", 0, (int *) &must_exist, 1 }, + { "path", 1, 0, 0 }, + { "no-mktex", 1, 0, 0 }, + { "progname", 1, 0, 0 }, + { "safe-in-name", 1, 0, 0 }, + { "safe-out-name", 1, 0, 0 }, + { "subdir", 1, 0, 0 }, + { "show-path", 1, 0, 0 }, + { "var-value", 1, 0, 0 }, { "version", 0, 0, 0 }, { 0, 0, 0, 0 } }; diff --git a/Build/source/texk/kpathsea/lib.h b/Build/source/texk/kpathsea/lib.h index ca1644c94fa..c6cafef7187 100644 --- a/Build/source/texk/kpathsea/lib.h +++ b/Build/source/texk/kpathsea/lib.h @@ -53,9 +53,9 @@ #define END_FATAL() fputs (".\n", stderr); exit (1); } while (0) -#define FATAL(str) \ +#define FATAL(str) \ START_FATAL (); fputs (str, stderr); END_FATAL () -#define FATAL1(str, e1) \ +#define FATAL1(str, e1) \ START_FATAL (); fprintf (stderr, str, e1); END_FATAL () #define FATAL2(str, e1, e2) \ START_FATAL (); fprintf (stderr, str, e1, e2); END_FATAL () @@ -71,25 +71,25 @@ #define START_WARNING() do { fputs ("warning: ", stderr) #define END_WARNING() fputs (".\n", stderr); fflush (stderr); } while (0) -#define WARNING(str) \ +#define WARNING(str) \ START_WARNING (); fputs (str, stderr); END_WARNING () -#define WARNING1(str, e1) \ +#define WARNING1(str, e1) \ START_WARNING (); fprintf (stderr, str, e1); END_WARNING () -#define WARNING2(str, e1, e2) \ +#define WARNING2(str, e1, e2) \ START_WARNING (); fprintf (stderr, str, e1, e2); END_WARNING () -#define WARNING3(str, e1, e2, e3) \ +#define WARNING3(str, e1, e2, e3) \ START_WARNING (); fprintf (stderr, str, e1, e2, e3); END_WARNING () -#define WARNING4(str, e1, e2, e3, e4) \ +#define WARNING4(str, e1, e2, e3, e4) \ START_WARNING (); fprintf (stderr, str, e1, e2, e3, e4); END_WARNING () #define LIB_START_FATAL() do { \ fprintf (stderr, "%s: fatal: ", kpse->invocation_name); -#define LIB_FATAL(str) \ +#define LIB_FATAL(str) \ LIB_START_FATAL (); fputs (str, stderr); END_FATAL () -#define LIB_FATAL1(str, e1) \ +#define LIB_FATAL1(str, e1) \ LIB_START_FATAL (); fprintf (stderr, str, e1); END_FATAL () -#define LIB_FATAL2(str, e1, e2) \ +#define LIB_FATAL2(str, e1, e2) \ LIB_START_FATAL (); fprintf (stderr, str, e1, e2); END_FATAL () diff --git a/Build/source/texk/kpathsea/mingw32.c b/Build/source/texk/kpathsea/mingw32.c index 4f86e151290..d2c5838e510 100644 --- a/Build/source/texk/kpathsea/mingw32.c +++ b/Build/source/texk/kpathsea/mingw32.c @@ -81,60 +81,60 @@ get_home_directory (void) char *found_home_directory = NULL; if ((found_home_directory = getenv("HOME")) != NULL) { - char q[MAXPATHLEN]; - /* In case it is %HOMEDRIVE%%HOMEPATH% */ - if (ExpandEnvironmentStrings(found_home_directory, q, sizeof(q)) == 0) { - /* Error */ - found_home_directory = NULL; - } - else { - found_home_directory = xstrdup(q); - goto done; - } + char q[MAXPATHLEN]; + /* In case it is %HOMEDRIVE%%HOMEPATH% */ + if (ExpandEnvironmentStrings(found_home_directory, q, sizeof(q)) == 0) { + /* Error */ + found_home_directory = NULL; + } + else { + found_home_directory = xstrdup(q); + goto done; + } } { - char *homedrive, *homepath; - if ((homedrive = getenv("HOMEDRIVE")) != NULL && - (homepath = getenv("HOMEPATH")) != NULL) { - found_home_directory = concat(homedrive, homepath); - goto done; - } + char *homedrive, *homepath; + if ((homedrive = getenv("HOMEDRIVE")) != NULL && + (homepath = getenv("HOMEPATH")) != NULL) { + found_home_directory = concat(homedrive, homepath); + goto done; + } } /* This method is the prefered one because even if it requires a more recent shell32.dll, it does not need to call SHMalloc()->Free() */ { - /* This will probably give the wrong value */ - char q [MAXPATHLEN]; - HINSTANCE h; + /* This will probably give the wrong value */ + char q [MAXPATHLEN]; + HINSTANCE h; pSHGetSpecialFolderPathA p1; pGetDesktopWindow p2; - HWND hwnd = NULL; - - if ((h = LoadLibrary("user32.dll"))) { - if ((p2 = (pGetDesktopWindow)GetProcAddress(h, "GetDesktopWindow"))) - hwnd = (*p2)(); - FreeLibrary(h); - } - - if (hwnd && (h = LoadLibrary("shell32.dll"))) { - if ((p1 = (pSHGetSpecialFolderPathA)GetProcAddress(h, "SHGetSpecialFolderPathA"))) - if ((*p1)(hwnd, q, CSIDL_PERSONAL, TRUE)) { - found_home_directory = xstrdup(q); - } - FreeLibrary(h); - } - if (found_home_directory) goto done; + HWND hwnd = NULL; + + if ((h = LoadLibrary("user32.dll"))) { + if ((p2 = (pGetDesktopWindow)GetProcAddress(h, "GetDesktopWindow"))) + hwnd = (*p2)(); + FreeLibrary(h); + } + + if (hwnd && (h = LoadLibrary("shell32.dll"))) { + if ((p1 = (pSHGetSpecialFolderPathA)GetProcAddress(h, "SHGetSpecialFolderPathA"))) + if ((*p1)(hwnd, q, CSIDL_PERSONAL, TRUE)) { + found_home_directory = xstrdup(q); + } + FreeLibrary(h); + } + if (found_home_directory) goto done; } if (1) { - fprintf(stderr, "kpathsea has been unable to determine a good value for the user's $HOME\n" - " directory, and will be using the value:\n" - " %s\n" - " This is probably incorrect.\n", - found_home_directory - ); + fprintf(stderr, "kpathsea has been unable to determine a good value for the user's $HOME\n" + " directory, and will be using the value:\n" + " %s\n" + " This is probably incorrect.\n", + found_home_directory + ); } done: return found_home_directory; @@ -144,8 +144,8 @@ get_home_directory (void) /* Consider cached volume information to be stale if older than 10s, at least for non-local drives. Info for fixed drives is never stale. */ #define DRIVE_INDEX( c ) ( (c) <= 'Z' ? (c) - 'A' : (c) - 'a' ) -#define VOLINFO_STILL_VALID( root_dir, info ) \ - ( ( isalpha (root_dir[0]) ) \ +#define VOLINFO_STILL_VALID( root_dir, info ) \ + ( ( isalpha (root_dir[0]) ) \ || GetTickCount () - info->timestamp < 10000 ) @@ -175,8 +175,8 @@ normalize_filename (char *fp, char path_sep) /* Remove unneeded double slashes */ ret = (IS_UNC_NAME(fp) ? 2 : - NAME_BEGINS_WITH_DEVICE(fp) ? - (IS_DIR_SEP(*(fp+2)) ? 3 : 2) : IS_DIR_SEP(*fp) ? 1 : 0); + NAME_BEGINS_WITH_DEVICE(fp) ? + (IS_DIR_SEP(*(fp+2)) ? 3 : 2) : IS_DIR_SEP(*fp) ? 1 : 0); for (i = ret, p = fp+i; IS_DIR_SEP(*p); i++, p++); @@ -194,7 +194,7 @@ normalize_filename (char *fp, char path_sep) if (path_sep) { for (p = fp; *p; p++) if (IS_DIR_SEP(*p)) - *p = path_sep; + *p = path_sep; } #if 0 @@ -235,19 +235,19 @@ crlf_to_lf (int n, unsigned char *buf, unsigned *lf_count) while (buf < endp - 1) { if (*buf == 0x0a) - (*lf_count)++; + (*lf_count)++; if (*buf == 0x0d) - { - if (*(++buf) != 0x0a) - *np++ = 0x0d; - } + { + if (*(++buf) != 0x0a) + *np++ = 0x0d; + } else - *np++ = *buf++; + *np++ = *buf++; } if (buf < endp) { if (*buf == 0x0a) - (*lf_count)++; + (*lf_count)++; *np++ = *buf++; } return np - startp; @@ -270,7 +270,7 @@ _parse_root (char * name, char ** pPath) /* skip past drive specifier */ name += 2; if (IS_DIR_SEP (name[0])) - name++; + name++; } else if (IS_DIR_SEP (name[0]) && IS_DIR_SEP (name[1])) { @@ -278,13 +278,13 @@ _parse_root (char * name, char ** pPath) name += 2; do { - if (IS_DIR_SEP (*name) && --slashes == 0) - break; - name++; - } + if (IS_DIR_SEP (*name) && --slashes == 0) + break; + name++; + } while ( *name ); if (IS_DIR_SEP (name[0])) - name++; + name++; } if (pPath) @@ -311,9 +311,9 @@ get_long_basename (char * name, char * buf, int size) if (strchr (p, '*') || strchr (p, '?')) { if ((len = strlen (p)) < size) - memcpy (buf, p, len + 1); + memcpy (buf, p, len + 1); else - len = 0; + len = 0; return len; } #endif @@ -322,9 +322,9 @@ get_long_basename (char * name, char * buf, int size) if (dir_handle != INVALID_HANDLE_VALUE) { if ((len = strlen (find_data.cFileName)) < size) - memcpy (buf, find_data.cFileName, len + 1); + memcpy (buf, find_data.cFileName, len + 1); else - len = 0; + len = 0; FindClose (dir_handle); } return len; @@ -361,21 +361,21 @@ win32_get_long_filename (char * name, char * buf, int size) if (p) *p = '\0'; len = get_long_basename (full, o, size); if (len > 0) - { - o += len; - size -= len; - if (p != NULL) - { - *p++ = '\\'; - if (size < 2) - return FALSE; - *o++ = '\\'; - size--; - *o = '\0'; - } - } + { + o += len; + size -= len; + if (p != NULL) + { + *p++ = '\\'; + if (size < 2) + return FALSE; + *o++ = '\\'; + size--; + *o = '\0'; + } + } else - return FALSE; + return FALSE; } while (p != NULL && *p); @@ -453,13 +453,13 @@ look_for_cmd(const char *cmd, char **app) /* Looking for appname on the path */ for (s = suffixes, go_on = TRUE; go_on; *s++) { - if (SearchPath(env_path, /* Address of search path */ - app_name, /* Address of filename */ - *s, /* Address of extension */ - MAXPATHLEN, /* Size of destination buffer */ - pname, /* Address of destination buffer */ - &fp) /* File part of app_name */ - != 0) { + if (SearchPath(env_path, /* Address of search path */ + app_name, /* Address of filename */ + *s, /* Address of extension */ + MAXPATHLEN, /* Size of destination buffer */ + pname, /* Address of destination buffer */ + &fp) /* File part of app_name */ + != 0) { #ifdef TRACE fprintf(stderr, "%s found with suffix %s\nin %s\n", app_name, *s, pname); #endif @@ -516,25 +516,25 @@ __unquote (char *to, const char *beg, const char *end) while (s < end) { switch (*s) - { - case '"': - case '\'': - if (!quote) - quote = *s; - else if (quote == *s) - quote = 0; - s++; - break; - case '\\': - if (s[1] == '"' || s[1] == '\'' - || (s[1] == ';' - && (__system_allow_multiple_cmds))) - s++; - /* Fall-through. */ - default: - *d++ = *s++; - break; - } + { + case '"': + case '\'': + if (!quote) + quote = *s; + else if (quote == *s) + quote = 0; + s++; + break; + case '\\': + if (s[1] == '"' || s[1] == '\'' + || (s[1] == ';' + && (__system_allow_multiple_cmds))) + s++; + /* Fall-through. */ + default: + *d++ = *s++; + break; + } } *d = 0; @@ -569,60 +569,60 @@ get_sym (char *s, char **beg, char **end) *end = s + 1; if (in_a_word - && (!*s || strchr ("<>| \t\n", *s) - || ((__system_allow_multiple_cmds) && *s == ';'))) + && (!*s || strchr ("<>| \t\n", *s) + || ((__system_allow_multiple_cmds) && *s == ';'))) { - --*end; - return WORDARG; + --*end; + return WORDARG; } switch (*s) { case '<': - return REDIR_INPUT; + return REDIR_INPUT; case '>': - if (**end == '>') - { - ++*end; - return REDIR_APPEND; - } - return REDIR_OUTPUT; + if (**end == '>') + { + ++*end; + return REDIR_APPEND; + } + return REDIR_OUTPUT; case '|': - return PIPE; + return PIPE; case ';': - if (__system_allow_multiple_cmds) - return SEMICOLON; - else - in_a_word = 1; - break; + if (__system_allow_multiple_cmds) + return SEMICOLON; + else + in_a_word = 1; + break; case '\0': - --*end; - return EOL; + --*end; + return EOL; case '\\': - if (s[1] == '"' || s[1] == '\'' - || (s[1] == ';' && (__system_allow_multiple_cmds))) - s++; - in_a_word = 1; - break; + if (s[1] == '"' || s[1] == '\'' + || (s[1] == ';' && (__system_allow_multiple_cmds))) + s++; + in_a_word = 1; + break; case '\'': case '"': - { - char quote = *s++; - - while (*s && *s != quote) - { - if (*s++ == '\\' && (*s == '"' || *s == '\'')) - s++; - } - *end = s; - if (!*s) - return UNMATCHED_QUOTE; - in_a_word = 1; - break; - } + { + char quote = *s++; + + while (*s && *s != quote) + { + if (*s++ == '\\' && (*s == '"' || *s == '\'')) + s++; + } + *end = s; + if (!*s) + return UNMATCHED_QUOTE; + in_a_word = 1; + break; + } default: - in_a_word = 1; - break; + in_a_word = 1; + break; } s++; @@ -643,8 +643,8 @@ parse_cmdline(char *line, char **input, char **output) int ncmd = 0, narg = 1; char **fp = NULL; char ***cmd; - char *dummy_input; /* So that we could pass NULL */ - char *dummy_output; /* instead of a real ??put */ + char *dummy_input; /* So that we could pass NULL */ + char *dummy_output; /* instead of a real ??put */ if (input == NULL) input = &dummy_input; if (output == NULL) output = &dummy_output; @@ -659,36 +659,36 @@ parse_cmdline(char *line, char **input, char **output) do { again = FALSE; prev_token = token; - token = get_sym (beg, &beg, &end); /* get next symbol */ + token = get_sym (beg, &beg, &end); /* get next symbol */ #ifdef TRACE fprintf(stderr, "token = %s\n", beg); -#endif +#endif switch (token) { case WORDARG: if (prev_token == REDIR_INPUT - || prev_token == REDIR_OUTPUT) { - fprintf(stderr, "Ambigous input/output redirect."); - bSuccess = FALSE; - goto leave; + || prev_token == REDIR_OUTPUT) { + fprintf(stderr, "Ambigous input/output redirect."); + bSuccess = FALSE; + goto leave; } /* First word we see is the program to run. */ if (needcmd) { - narg = 1; - cmd[ncmd] = xmalloc(narg * sizeof(char *)); - cmd[ncmd][narg - 1] = xmalloc(end - beg + 1); - __unquote (cmd[ncmd][narg - 1], beg, end); /* unquote and copy to prog */ - if (cmd[ncmd][narg - 1][0] == '(') { - fprintf(stderr, "parse_cmdline(%s): Parenthesized groups not allowed.\n", line); - bSuccess = FALSE; - goto leave; - } - needcmd = FALSE; + narg = 1; + cmd[ncmd] = xmalloc(narg * sizeof(char *)); + cmd[ncmd][narg - 1] = xmalloc(end - beg + 1); + __unquote (cmd[ncmd][narg - 1], beg, end); /* unquote and copy to prog */ + if (cmd[ncmd][narg - 1][0] == '(') { + fprintf(stderr, "parse_cmdline(%s): Parenthesized groups not allowed.\n", line); + bSuccess = FALSE; + goto leave; + } + needcmd = FALSE; } else { - narg++; - cmd[ncmd] = xrealloc(cmd[ncmd], narg * sizeof(char *)); - cmd[ncmd][narg - 1] = xmalloc(end - beg + 1); - __unquote (cmd[ncmd][narg - 1], beg, end); /* unquote and copy to prog */ + narg++; + cmd[ncmd] = xrealloc(cmd[ncmd], narg * sizeof(char *)); + cmd[ncmd][narg - 1] = xmalloc(end - beg + 1); + __unquote (cmd[ncmd][narg - 1], beg, end); /* unquote and copy to prog */ } beg = end; /* go forward */ again = TRUE; @@ -698,30 +698,30 @@ parse_cmdline(char *line, char **input, char **output) case REDIR_OUTPUT: case REDIR_APPEND: if (token == REDIR_INPUT) { - if (*input) { - fprintf(stderr, "Ambiguous input redirect."); - errno = EINVAL; - bSuccess = FALSE; - goto leave; - } - fp = input; + if (*input) { + fprintf(stderr, "Ambiguous input redirect."); + errno = EINVAL; + bSuccess = FALSE; + goto leave; + } + fp = input; } else if (token == REDIR_OUTPUT || token == REDIR_APPEND) { - if (*output) { - fprintf(stderr, "Ambiguous output redirect."); - errno = EINVAL; - bSuccess = FALSE; - goto leave; - } - fp = output; - if (token == REDIR_APPEND) - append_out = TRUE; + if (*output) { + fprintf(stderr, "Ambiguous output redirect."); + errno = EINVAL; + bSuccess = FALSE; + goto leave; + } + fp = output; + if (token == REDIR_APPEND) + append_out = TRUE; } if (get_sym (end, &end, &new_end) != WORDARG) { - fprintf(stderr, "Target of redirect is not a filename."); - errno = EINVAL; - bSuccess = FALSE; - goto leave; + fprintf(stderr, "Target of redirect is not a filename."); + errno = EINVAL; + bSuccess = FALSE; + goto leave; } *fp = (char *)xmalloc (new_end - end + 1); memcpy (*fp, end, new_end - end); @@ -731,10 +731,10 @@ parse_cmdline(char *line, char **input, char **output) break; case PIPE: if (*output) { - fprintf(stderr, "Ambiguous output redirect."); - errno = EINVAL; - bSuccess = FALSE; - goto leave; + fprintf(stderr, "Ambiguous output redirect."); + errno = EINVAL; + bSuccess = FALSE; + goto leave; } narg++; cmd[ncmd] = xrealloc(cmd[ncmd], narg * sizeof(char *)); @@ -747,10 +747,10 @@ parse_cmdline(char *line, char **input, char **output) case SEMICOLON: case EOL: if (needcmd) { - fprintf(stderr, "No command name seen."); - errno = EINVAL; - bSuccess = FALSE; - goto leave; + fprintf(stderr, "No command name seen."); + errno = EINVAL; + bSuccess = FALSE; + goto leave; } narg++; cmd[ncmd] = xrealloc(cmd[ncmd], narg * sizeof(char *)); @@ -759,7 +759,7 @@ parse_cmdline(char *line, char **input, char **output) cmd[ncmd] = NULL; again = FALSE; break; - + case UNMATCHED_QUOTE: fprintf(stderr, "Unmatched quote character."); errno = EINVAL; @@ -773,7 +773,7 @@ parse_cmdline(char *line, char **input, char **output) } - } while (again); + } while (again); leave: if (!bSuccess) { @@ -782,12 +782,12 @@ parse_cmdline(char *line, char **input, char **output) /* Need to free everything that was allocated */ for (i = 0; i < ncmd; i++) { for (p = cmd[i]; *p; p++) - free(*p); + free(*p); free(cmd[i]); } if (cmd[ncmd]) { for (i = 0; i < narg; i++) - free(cmd[ncmd][i]); + free(cmd[ncmd][i]); free(cmd[ncmd]); } free(cmd); @@ -913,45 +913,45 @@ win32_system(const char *cmd, int async) /* First time, use red_input if available */ if (i == 0) { if (red_input) { - hIn = CreateFile(red_input, - GENERIC_READ, - FILE_SHARE_READ | FILE_SHARE_WRITE, - &sa, - OPEN_EXISTING, - FILE_ATTRIBUTE_NORMAL, - NULL); - if (hIn == INVALID_HANDLE_VALUE) { + hIn = CreateFile(red_input, + GENERIC_READ, + FILE_SHARE_READ | FILE_SHARE_WRITE, + &sa, + OPEN_EXISTING, + FILE_ATTRIBUTE_NORMAL, + NULL); + if (hIn == INVALID_HANDLE_VALUE) { #ifdef _TRACE - fprintf(stderr, "system: failed to open hIn (%s) with error %d.\n", red_input, GetLastError()); + fprintf(stderr, "system: failed to open hIn (%s) with error %d.\n", red_input, GetLastError()); #endif - errno = EIO; - return -1; - } + errno = EIO; + return -1; + } } else { - hIn = GetStdHandle(STD_INPUT_HANDLE); + hIn = GetStdHandle(STD_INPUT_HANDLE); } } /* Last time, use red_output if available */ if (cmd_pipe[i+1] == NULL) { if (red_output) { - hOut = CreateFile(red_output, - GENERIC_WRITE, - FILE_SHARE_READ | FILE_SHARE_WRITE, - &sa, - OPEN_ALWAYS, - FILE_ATTRIBUTE_NORMAL, - NULL); - if (hOut == INVALID_HANDLE_VALUE) { + hOut = CreateFile(red_output, + GENERIC_WRITE, + FILE_SHARE_READ | FILE_SHARE_WRITE, + &sa, + OPEN_ALWAYS, + FILE_ATTRIBUTE_NORMAL, + NULL); + if (hOut == INVALID_HANDLE_VALUE) { #ifdef _TRACE - fprintf(stderr, "system: failed to open hOut (%s) with error %d.\n", red_output, GetLastError()); + fprintf(stderr, "system: failed to open hOut (%s) with error %d.\n", red_output, GetLastError()); #endif - errno = EIO; - return -1; - } + errno = EIO; + return -1; + } } else { - hOut = GetStdHandle(STD_OUTPUT_HANDLE); + hOut = GetStdHandle(STD_OUTPUT_HANDLE); } } @@ -967,15 +967,15 @@ win32_system(const char *cmd, int async) fprintf(stderr, "Executing: %s\n", new_cmd); #endif if (CreateProcess(app_name, - new_cmd, - NULL, - NULL, - TRUE, - 0, - NULL, - NULL, - &si, - &pi) == 0) { + new_cmd, + NULL, + NULL, + TRUE, + 0, + NULL, + NULL, + &si, + &pi) == 0) { fprintf(stderr, "win32_system(%s) call failed (Error %d).\n", cmd, (int)GetLastError()); return -1; } @@ -985,14 +985,14 @@ win32_system(const char *cmd, int async) if (async == 0) { if (WaitForSingleObject(pi.hProcess, INFINITE) == WAIT_OBJECT_0) { - if (GetExitCodeProcess(pi.hProcess, &ret) == 0) { - fprintf(stderr, "Failed to retrieve exit code: %s (Error %d)\n", cmd, (int)GetLastError()); - ret = -1; - } + if (GetExitCodeProcess(pi.hProcess, &ret) == 0) { + fprintf(stderr, "Failed to retrieve exit code: %s (Error %d)\n", cmd, (int)GetLastError()); + ret = -1; + } } else { fprintf(stderr, "Failed to wait for process termination: %s (Error %d)\n", cmd, (int)GetLastError()); - ret = -1; + ret = -1; } } diff --git a/Build/source/texk/kpathsea/path-elt.c b/Build/source/texk/kpathsea/path-elt.c index eb45d38da02..68a18490976 100644 --- a/Build/source/texk/kpathsea/path-elt.c +++ b/Build/source/texk/kpathsea/path-elt.c @@ -123,14 +123,14 @@ int main () { /* All lists end with NULL. */ - print_path_elements (NULL); /* */ - print_path_elements (""); /* "" */ - print_path_elements ("a"); /* a */ - print_path_elements (ENV_SEP_STRING); /* "", "" */ - print_path_elements (ENV_SEP_STRING ENV_SEP_STRING); /* "", "", "" */ - print_path_elements ("a" ENV_SEP_STRING); /* a, "" */ - print_path_elements (ENV_SEP_STRING "b"); /* "", b */ - print_path_elements ("a" ENV_SEP_STRING "b"); /* a, b */ + print_path_elements (NULL); /* */ + print_path_elements (""); /* "" */ + print_path_elements ("a"); /* a */ + print_path_elements (ENV_SEP_STRING); /* "", "" */ + print_path_elements (ENV_SEP_STRING ENV_SEP_STRING); /* "", "", "" */ + print_path_elements ("a" ENV_SEP_STRING); /* a, "" */ + print_path_elements (ENV_SEP_STRING "b"); /* "", b */ + print_path_elements ("a" ENV_SEP_STRING "b"); /* a, b */ return 0; } diff --git a/Build/source/texk/kpathsea/pathsearch.c b/Build/source/texk/kpathsea/pathsearch.c index 0e68414e468..d42fdb396ed 100644 --- a/Build/source/texk/kpathsea/pathsearch.c +++ b/Build/source/texk/kpathsea/pathsearch.c @@ -31,7 +31,7 @@ #include <time.h> /* for `time' */ #ifdef __DJGPP__ -#include <sys/stat.h> /* for stat bits */ +#include <sys/stat.h> /* for stat bits */ #endif /* The very first search is for texmf.cnf, called when someone tries to @@ -348,7 +348,7 @@ search (kpathsea kpse, const_string path, const_string original_name, unsigned short save_djgpp_flags = _djstat_flags; _djstat_flags = _STAT_EXEC_MAGIC | _STAT_EXEC_EXT - | _STAT_ROOT_TIME | _STAT_WRITEBIT; + | _STAT_ROOT_TIME | _STAT_WRITEBIT; #endif /* Make a leading ~ count as an absolute filename, and expand $FOO's. */ @@ -435,7 +435,7 @@ search_list (kpathsea kpse, const_string path, const_string* names, unsigned short save_djgpp_flags = _djstat_flags; _djstat_flags = _STAT_EXEC_MAGIC | _STAT_EXEC_EXT - | _STAT_ROOT_TIME | _STAT_WRITEBIT; + | _STAT_ROOT_TIME | _STAT_WRITEBIT; #endif ret_list = str_list_init(); diff --git a/Build/source/texk/kpathsea/progname.c b/Build/source/texk/kpathsea/progname.c index 2585550e4d8..e93e2b9c849 100644 --- a/Build/source/texk/kpathsea/progname.c +++ b/Build/source/texk/kpathsea/progname.c @@ -156,14 +156,14 @@ CopyFirst (register char *a, char *b) /* Returns NULL on error. Prints intermediate results if global `ll_verbose' is nonzero. */ -#define EX(s) (strlen (s) && strcmp (s, "/") ? "/" : "") -#define EXPOS EX(post) -#define EXPRE EX(pre) +#define EX(s) (strlen (s) && strcmp (s, "/") ? "/" : "") +#define EXPOS EX(post) +#define EXPRE EX(pre) static char * expand_symlinks (kpathsea kpse, char *s) { - static char pre[BSIZE]; /* return value */ + static char pre[BSIZE]; /* return value */ char post[BSIZE], sym[BSIZE], tmp[BSIZE], before[BSIZE]; char *cp; char a; @@ -207,7 +207,7 @@ expand_symlinks (kpathsea kpse, char *s) strcpy (pre, ""); } else { - a = pre[0]; /* handle links through the root */ + a = pre[0]; /* handle links through the root */ strcpy (tmp, StripLast (pre)); if (!strlen (pre) && a == '/') strcpy (pre, "/"); @@ -220,7 +220,7 @@ expand_symlinks (kpathsea kpse, char *s) /* Strip "../" path elements from the front of sym; print new result if there were any such elements. */ done = 0; - a = pre[0]; /* handle links through the root */ + a = pre[0]; /* handle links through the root */ while (!strncmp (sym, "..", 2) && (sym[2] == 0 || sym[2] == '/') && strlen (pre) != 0 @@ -556,39 +556,39 @@ kpathsea_set_program_name (kpathsea kpse, const_string argv0, char *fp; if (long_progname[1] != ':') { - /* A complication: `_truename' returns network-specific string at - the beginning of `long_progname' when the program resides on a - networked drive, and DOS calls cannot grok such pathnames. We - need to convert the filesystem name back to a drive letter. */ - char rootname[PATH_MAX], rootdir[4]; - - if (argv0[0] && argv0[1] == ':') - rootdir[0] = argv0[0]; /* explicit drive in `argv0' */ - else - rootdir[0] = getdisk () + 'A'; - rootdir[1] = ':'; - rootdir[2] = '\\'; - rootdir[3] = '\0'; - if (_truename (rootdir, rootname)) { - /* Find out where `rootname' ends in `long_progname' and replace - it with the drive letter. */ - int root_len = strlen (rootname); - - if (IS_DIR_SEP (rootname[root_len - 1])) - root_len--; /* keep the trailing slash */ - long_progname[0] = rootdir[0]; - long_progname[1] = ':'; - memmove (long_progname + 2, long_progname + root_len, - strlen (long_progname + root_len) + 1); - } + /* A complication: `_truename' returns network-specific string at + the beginning of `long_progname' when the program resides on a + networked drive, and DOS calls cannot grok such pathnames. We + need to convert the filesystem name back to a drive letter. */ + char rootname[PATH_MAX], rootdir[4]; + + if (argv0[0] && argv0[1] == ':') + rootdir[0] = argv0[0]; /* explicit drive in `argv0' */ + else + rootdir[0] = getdisk () + 'A'; + rootdir[1] = ':'; + rootdir[2] = '\\'; + rootdir[3] = '\0'; + if (_truename (rootdir, rootname)) { + /* Find out where `rootname' ends in `long_progname' and replace + it with the drive letter. */ + int root_len = strlen (rootname); + + if (IS_DIR_SEP (rootname[root_len - 1])) + root_len--; /* keep the trailing slash */ + long_progname[0] = rootdir[0]; + long_progname[1] = ':'; + memmove (long_progname + 2, long_progname + root_len, + strlen (long_progname + root_len) + 1); + } } /* Convert everything to canonical form. */ if (long_progname[0] >= 'A' && long_progname[0] <= 'Z') - long_progname[0] += 'a' - 'A'; /* make drive lower case, for beauty */ + long_progname[0] += 'a' - 'A'; /* make drive lower case, for beauty */ for (fp = long_progname; *fp; fp++) - if (IS_DIR_SEP (*fp)) - *fp = DIR_SEP; + if (IS_DIR_SEP (*fp)) + *fp = DIR_SEP; kpse->invocation_name = xstrdup (long_progname); } diff --git a/Build/source/texk/kpathsea/putenv.c b/Build/source/texk/kpathsea/putenv.c index e1b48513b19..34cbd3add89 100644 --- a/Build/source/texk/kpathsea/putenv.c +++ b/Build/source/texk/kpathsea/putenv.c @@ -1,11 +1,11 @@ /****************************************************************/ -/* */ -/* putenv(3) */ -/* */ -/* Change or add an environment entry */ -/* */ +/* */ +/* putenv(3) */ +/* */ +/* Change or add an environment entry */ +/* */ /****************************************************************/ -/* origination 1987-Oct-7 T. Holm */ +/* origination 1987-Oct-7 T. Holm */ /****************************************************************/ /* @@ -33,31 +33,31 @@ char *strchr(); char *malloc(); /****************************************************************/ -/* */ -/* int */ -/* putenv( entry ) */ -/* */ -/* The "entry" should follow the form */ -/* "NAME=VALUE". This routine will search the */ -/* user environment for "NAME" and replace its */ -/* value with "VALUE". */ -/* */ -/* Note that "entry" is not copied, it is used */ -/* as the environment entry. This means that it */ -/* must not be unallocated or otherwise modifed */ -/* by the caller, unless it is replaced by a */ -/* subsequent putenv(). */ -/* */ -/* If the name is not found in the environment, */ -/* then a new vector of pointers is allocated, */ -/* "entry" is put at the end and the global */ -/* variable "environ" is updated. */ -/* */ -/* This function normally returns 0, but -1 */ -/* is returned if it can not allocate enough */ -/* space using malloc(3), or "entry" does not */ -/* contain a '='. */ -/* */ +/* */ +/* int */ +/* putenv( entry ) */ +/* */ +/* The "entry" should follow the form */ +/* "NAME=VALUE". This routine will search the */ +/* user environment for "NAME" and replace its */ +/* value with "VALUE". */ +/* */ +/* Note that "entry" is not copied, it is used */ +/* as the environment entry. This means that it */ +/* must not be unallocated or otherwise modifed */ +/* by the caller, unless it is replaced by a */ +/* subsequent putenv(). */ +/* */ +/* If the name is not found in the environment, */ +/* then a new vector of pointers is allocated, */ +/* "entry" is put at the end and the global */ +/* variable "environ" is updated. */ +/* */ +/* This function normally returns 0, but -1 */ +/* is returned if it can not allocate enough */ +/* space using malloc(3), or "entry" does not */ +/* contain a '='. */ +/* */ /****************************************************************/ diff --git a/Build/source/texk/kpathsea/readable.c b/Build/source/texk/kpathsea/readable.c index 96eae10b0ef..df3ddeb3a5c 100644 --- a/Build/source/texk/kpathsea/readable.c +++ b/Build/source/texk/kpathsea/readable.c @@ -44,18 +44,18 @@ READABLE(const_string fn, unsigned int st) } else { switch(GetLastError()) { case ERROR_BUFFER_OVERFLOW: - errno = ENAMETOOLONG; - break; + errno = ENAMETOOLONG; + break; case ERROR_ACCESS_DENIED: - errno = EACCES; - break; + errno = EACCES; + break; default : - errno = EIO; /* meaningless, will make ret=NULL later */ - break; + errno = EIO; /* meaningless, will make ret=NULL later */ + break; } } return ((st != 0xFFFFFFFF) && - !(st & FILE_ATTRIBUTE_DIRECTORY)); + !(st & FILE_ATTRIBUTE_DIRECTORY)); } #else #define READABLE(fn, st) \ @@ -111,4 +111,3 @@ kpse_readable_file (const_string name) return kpathsea_readable_file (kpse_def, name); } #endif - diff --git a/Build/source/texk/kpathsea/strcasecmp.c b/Build/source/texk/kpathsea/strcasecmp.c index 28a6d7b8481..481a1ae45f7 100644 --- a/Build/source/texk/kpathsea/strcasecmp.c +++ b/Build/source/texk/kpathsea/strcasecmp.c @@ -44,7 +44,7 @@ strcasecmp (s1, s2) c1 = tolower (*p1++); c2 = tolower (*p2++); if (c1 == '\0') - break; + break; } while (c1 == c2); @@ -69,7 +69,7 @@ strncasecmp (s1, s2, n) c1 = tolower (*p1++); c2 = tolower (*p2++); if (c1 == '\0' || c1 != c2) - return c1 - c2; + return c1 - c2; } while (--n > 0); return c1 - c2; diff --git a/Build/source/texk/kpathsea/strstr.c b/Build/source/texk/kpathsea/strstr.c index 6a56025c41c..4042c492872 100644 --- a/Build/source/texk/kpathsea/strstr.c +++ b/Build/source/texk/kpathsea/strstr.c @@ -25,7 +25,7 @@ * I deliberately chose not to comment it. You should have at least * as much fun trying to understand it, as I had to write it :-). * - * Stephen R. van den Berg, berg@pool.informatik.rwth-aachen.de */ + * Stephen R. van den Berg, berg@pool.informatik.rwth-aachen.de */ #ifdef HAVE_CONFIG_H #include <config.h> @@ -47,71 +47,71 @@ strstr (phaystack, pneedle) b = *needle; if (b != '\0') { - haystack--; /* possible ANSI violation */ + haystack--; /* possible ANSI violation */ do - { - c = *++haystack; - if (c == '\0') - goto ret0; - } + { + c = *++haystack; + if (c == '\0') + goto ret0; + } while (c != b); c = *++needle; if (c == '\0') - goto foundneedle; + goto foundneedle; ++needle; goto jin; for (;;) { register chartype a; - register const unsigned char *rhaystack, *rneedle; - - do - { - a = *++haystack; - if (a == '\0') - goto ret0; - if (a == b) - break; - a = *++haystack; - if (a == '\0') - goto ret0; -shloop: ; + register const unsigned char *rhaystack, *rneedle; + + do + { + a = *++haystack; + if (a == '\0') + goto ret0; + if (a == b) + break; + a = *++haystack; + if (a == '\0') + goto ret0; +shloop: ; } while (a != b); -jin: a = *++haystack; - if (a == '\0') - goto ret0; - - if (a != c) - goto shloop; - - rhaystack = haystack-- + 1; - rneedle = needle; - a = *rneedle; - - if (*rhaystack == a) - do - { - if (a == '\0') - goto foundneedle; - ++rhaystack; - a = *++needle; - if (*rhaystack != a) - break; - if (a == '\0') - goto foundneedle; - ++rhaystack; - a = *++needle; - } - while (*rhaystack == a); - - needle = rneedle; /* took the register-poor aproach */ - - if (a == '\0') - break; +jin: a = *++haystack; + if (a == '\0') + goto ret0; + + if (a != c) + goto shloop; + + rhaystack = haystack-- + 1; + rneedle = needle; + a = *rneedle; + + if (*rhaystack == a) + do + { + if (a == '\0') + goto foundneedle; + ++rhaystack; + a = *++needle; + if (*rhaystack != a) + break; + if (a == '\0') + goto foundneedle; + ++rhaystack; + a = *++needle; + } + while (*rhaystack == a); + + needle = rneedle; /* took the register-poor aproach */ + + if (a == '\0') + break; } } foundneedle: diff --git a/Build/source/texk/kpathsea/strtol.c b/Build/source/texk/kpathsea/strtol.c index 9c74eec9a57..a1864c6f7ed 100644 --- a/Build/source/texk/kpathsea/strtol.c +++ b/Build/source/texk/kpathsea/strtol.c @@ -132,16 +132,16 @@ INTERNAL (strtol) (nptr, endptr, base, group) { grouping = _NL_CURRENT (LC_NUMERIC, GROUPING); if (*grouping <= 0 || *grouping == CHAR_MAX) - grouping = NULL; + grouping = NULL; else - { - /* Figure out the thousands separator character. */ - if (mbtowc (&thousands, _NL_CURRENT (LC_NUMERIC, THOUSANDS_SEP), - strlen (_NL_CURRENT (LC_NUMERIC, THOUSANDS_SEP))) <= 0) - thousands = (wchar_t) *_NL_CURRENT (LC_NUMERIC, THOUSANDS_SEP); - if (thousands == L'\0') - grouping = NULL; - } + { + /* Figure out the thousands separator character. */ + if (mbtowc (&thousands, _NL_CURRENT (LC_NUMERIC, THOUSANDS_SEP), + strlen (_NL_CURRENT (LC_NUMERIC, THOUSANDS_SEP))) <= 0) + thousands = (wchar_t) *_NL_CURRENT (LC_NUMERIC, THOUSANDS_SEP); + if (thousands == L'\0') + grouping = NULL; + } } else grouping = NULL; @@ -179,13 +179,13 @@ INTERNAL (strtol) (nptr, endptr, base, group) if (base == 0) if (*s == '0') { - if (toupper (s[1]) == 'X') - { - s += 2; - base = 16; - } - else - base = 8; + if (toupper (s[1]) == 'X') + { + s += 2; + base = 16; + } + else + base = 8; } else base = 10; @@ -199,13 +199,13 @@ INTERNAL (strtol) (nptr, endptr, base, group) /* Find the end of the digit string and check its grouping. */ end = s; for (c = *end; c != '\0'; c = *++end) - if (c != thousands && !isdigit (c) && - (!isalpha (c) || toupper (c) - 'A' + 10 >= base)) - break; + if (c != thousands && !isdigit (c) && + (!isalpha (c) || toupper (c) - 'A' + 10 >= base)) + break; if (*s == thousands) - end = s; + end = s; else - end = correctly_grouped_prefix (s, end, thousands, grouping); + end = correctly_grouped_prefix (s, end, thousands, grouping); } else #endif @@ -219,23 +219,23 @@ INTERNAL (strtol) (nptr, endptr, base, group) for (c = *s; c != '\0'; c = *++s) { if (s == end) - break; + break; if (isdigit (c)) - c -= '0'; + c -= '0'; else if (isalpha (c)) - c = toupper (c) - 'A' + 10; + c = toupper (c) - 'A' + 10; else - break; + break; if (c >= base) - break; + break; /* Check for overflow. */ if (i > cutoff || (i == cutoff && c > cutlim)) - overflow = 1; + overflow = 1; else - { - i *= (unsigned LONG int) base; - i += c; - } + { + i *= (unsigned LONG int) base; + i += c; + } } /* Check if anything actually happened. */ @@ -251,7 +251,7 @@ INTERNAL (strtol) (nptr, endptr, base, group) /* Check for a value that is within the range of `unsigned LONG int', but outside the range of `LONG int'. */ if (i > (negative ? - -(unsigned LONG int) LONG_MIN : (unsigned LONG int) LONG_MAX)) + -(unsigned LONG int) LONG_MIN : (unsigned LONG int) LONG_MAX)) overflow = 1; #endif diff --git a/Build/source/texk/kpathsea/tex-file.c b/Build/source/texk/kpathsea/tex-file.c index 4de7378081d..7e5d501e32b 100644 --- a/Build/source/texk/kpathsea/tex-file.c +++ b/Build/source/texk/kpathsea/tex-file.c @@ -220,11 +220,11 @@ kpse_maketex_option (const_string fmtname, boolean value) /* Macro subroutine for `init_path'. EXPAND_DEFAULT calls kpse_expand_default on try_path and the present info->path. */ -#define EXPAND_DEFAULT(try_path, source_string) \ - if (try_path) { \ - info->raw_path = try_path; \ - info->path = kpathsea_expand_default (kpse, try_path, info->path); \ - info->path_source = source_string; \ +#define EXPAND_DEFAULT(try_path, source_string) \ + if (try_path) { \ + info->raw_path = try_path; \ + info->path = kpathsea_expand_default (kpse, try_path, info->path); \ + info->path_source = source_string; \ } /* Find the final search path to use for the format entry INFO, given @@ -1115,7 +1115,7 @@ static const_string ok_type_name[] = { static boolean kpathsea_name_ok (kpathsea kpse, const_string fname, const_string check_var, - const_string default_choice, ok_type action, boolean silent) + const_string default_choice, ok_type action, boolean silent) { /* We distinguish three cases: 'a' (any) allows any file to be opened. diff --git a/Build/source/texk/kpathsea/tex-glyph.h b/Build/source/texk/kpathsea/tex-glyph.h index 7a6c87ae49f..971749c1ca4 100644 --- a/Build/source/texk/kpathsea/tex-glyph.h +++ b/Build/source/texk/kpathsea/tex-glyph.h @@ -35,11 +35,11 @@ typedef enum typedef struct { - string name; /* font name found */ - unsigned dpi; /* size found, for glyphs */ - kpse_file_format_type format; /* glyph format found */ - kpse_glyph_source_type source; /* where we found it */ -} kpse_glyph_file_type; + string name; /* font name found */ + unsigned dpi; /* size found, for glyphs */ + kpse_file_format_type format; /* glyph format found */ + kpse_glyph_source_type source; /* where we found it */ +} kpse_glyph_file_type; #define KPSE_GLYPH_FILE_NAME(f) ((f).name) #define KPSE_GLYPH_FILE_DPI(f) ((f).dpi) diff --git a/Build/source/texk/kpathsea/types.h b/Build/source/texk/kpathsea/types.h index d53f08395ec..e16e428145e 100644 --- a/Build/source/texk/kpathsea/types.h +++ b/Build/source/texk/kpathsea/types.h @@ -86,7 +86,7 @@ typedef enum { kpse_gf_format, kpse_pk_format, - kpse_any_glyph_format, /* ``any'' meaning gf or pk */ + kpse_any_glyph_format, /* ``any'' meaning gf or pk */ kpse_tfm_format, kpse_afm_format, kpse_base_format, @@ -168,21 +168,21 @@ typedef enum typedef struct { - const_string type; /* Human-readable description. */ - const_string path; /* The search path to use. */ - const_string raw_path; /* Pre-$~ (but post-default) expansion. */ - const_string path_source; /* Where the path started from. */ - const_string override_path; /* From client environment variable. */ - const_string client_path; /* E.g., from dvips's config.ps. */ - const_string cnf_path; /* From texmf.cnf. */ - const_string default_path; /* If all else fails. */ - const_string *suffix; /* For kpse_find_file to check for/append. */ - const_string *alt_suffix; /* More suffixes to check for. */ - boolean suffix_search_only; /* Only search with a suffix? */ - const_string program; /* ``mktexpk'', etc. */ - int argc; /* Count of standard arguments. */ - const_string *argv; /* Standard arguments to `program'. */ - boolean program_enabled_p; /* Invoke `program'? */ + const_string type; /* Human-readable description. */ + const_string path; /* The search path to use. */ + const_string raw_path; /* Pre-$~ (but post-default) expansion. */ + const_string path_source; /* Where the path started from. */ + const_string override_path; /* From client environment variable. */ + const_string client_path; /* E.g., from dvips's config.ps. */ + const_string cnf_path; /* From texmf.cnf. */ + const_string default_path; /* If all else fails. */ + const_string *suffix; /* For kpse_find_file to check for/append. */ + const_string *alt_suffix; /* More suffixes to check for. */ + boolean suffix_search_only; /* Only search with a suffix? */ + const_string program; /* ``mktexpk'', etc. */ + int argc; /* Count of standard arguments. */ + const_string *argv; /* Standard arguments to `program'. */ + boolean program_enabled_p; /* Invoke `program'? */ kpse_src_type program_enable_level; /* Who said to invoke `program'. */ boolean binmode; /* Open files in binary mode? */ } kpse_format_info_type; diff --git a/Build/source/texk/kpathsea/win32lib.h b/Build/source/texk/kpathsea/win32lib.h index abea8a2bb8d..fdc1cd999c7 100644 --- a/Build/source/texk/kpathsea/win32lib.h +++ b/Build/source/texk/kpathsea/win32lib.h @@ -15,7 +15,7 @@ #pragma warning(disable: 4255) #define boolean donotuse_boolean -#include <windows.h> /* Somewhere here WIN32 gets defined */ +#include <windows.h> /* Somewhere here WIN32 gets defined */ #undef boolean #if _MSC_VER>=1200 |