texlive[41701] Master/texmf-dist: texosquery (14jul16)

commits+karl at tug.org commits+karl at tug.org
Thu Jul 14 23:41:44 CEST 2016


Revision: 41701
          http://tug.org/svn/texlive?view=revision&revision=41701
Author:   karl
Date:     2016-07-14 23:41:44 +0200 (Thu, 14 Jul 2016)
Log Message:
-----------
texosquery (14jul16)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/support/texosquery/texosquery.pdf
    trunk/Master/texmf-dist/scripts/texosquery/texosquery.jar
    trunk/Master/texmf-dist/source/support/texosquery/TeXOSQuery.java
    trunk/Master/texmf-dist/source/support/texosquery/texosquery.dtx
    trunk/Master/texmf-dist/tex/latex/texosquery/texosquery.sty
    trunk/Master/texmf-dist/tex/latex/texosquery/texosquery.tex

Added Paths:
-----------
    trunk/Master/texmf-dist/doc/support/texosquery/CHANGES

Added: trunk/Master/texmf-dist/doc/support/texosquery/CHANGES
===================================================================
--- trunk/Master/texmf-dist/doc/support/texosquery/CHANGES	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/support/texosquery/CHANGES	2016-07-14 21:41:44 UTC (rev 41701)
@@ -0,0 +1,27 @@
+1.1 (2016-07-14):
+
+ * texosquery.jar:
+
+   - Added --dirname (-e)
+
+   - Multiline results add braces to each line
+     (to make it easier to parse the results in TeX).
+
+   - Code refactored.
+
+   - Code now compiled for Java 5 to support users with 
+     old versions of the JRE.
+
+ * texosquery.tex:
+
+   - \TeXOSQueryNow and \TeXOSQueryFileDate set the category
+     code of D to 12 (to match \pdfcreationdate).
+
+   - new command \TeXOSQueryDirName
+
+   - dry run mode is now by default on unless shell escape=1
+     (unrestricted mode)
+
+1.0 (2016-07-08):
+
+ * Initial release

Modified: trunk/Master/texmf-dist/doc/support/texosquery/texosquery.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/scripts/texosquery/texosquery.jar
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/source/support/texosquery/TeXOSQuery.java
===================================================================
--- trunk/Master/texmf-dist/source/support/texosquery/TeXOSQuery.java	2016-07-14 21:41:30 UTC (rev 41700)
+++ trunk/Master/texmf-dist/source/support/texosquery/TeXOSQuery.java	2016-07-14 21:41:44 UTC (rev 41701)
@@ -1,681 +1,767 @@
 package com.dickimawbooks.texosquery;
 
+import java.io.BufferedReader;
 import java.util.Locale;
 import java.util.Calendar;
-import java.io.*;
+import java.io.File;
+import java.io.FilenameFilter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
 
-public class TeXOSQuery
-{
-   public static String escapeHash(String str)
-   {
-      return str.replaceAll("#", "\\\\#");
-   }
+/**
+ * Main class.
+ * @author Nicola Talbot
+ * @version 1.1
+ * @since 1.0
+ */
+public class TeXOSQuery {
 
-   public static String getLocale(Locale locale)
-   {
-      return getLocale(locale, false);
-   }
+    private static final String VERSION_NUMBER = "1.1";
+    private static final String VERSION_DATE = "2016-07-14";
+    private static final char BACKSLASH = '\\';
+    private static final char FORWARDSLASH = '/';
+    private static final long ZERO = 0L;
+    
+    /**
+     * Escapes hash from input string.
+     * @param string Input string.
+     * @return String with hash escaped.
+     */
+    private static String escapeHash(String string) {
+        return string.replaceAll("#", "\\\\#");
+    }
 
-   public static String getLocale(Locale locale, boolean convertCodeset)
-   {
-      String id = "";
+    /**
+     * Gets a string representation of the provided locale.
+     * @param locale The provided locale.
+     * @return String representation.
+     */
+    private static String getLocale(Locale locale) {
+        return getLocale(locale, false);
+    }
 
-      if (locale != null)
-      {
-         String lang = locale.getLanguage();
+    /**
+     * Gets a string representation of the provided locale, converting the code
+     * set if possible.
+     * @param locale The provided locale.
+     * @param convertCodeset Boolean value to convert the code set.
+     * @return String representation.
+     */
+    private static String getLocale(Locale locale, boolean convertCodeset) {
+        
+        String identifier = "";
 
-         if (lang != null)
-         {
-            id = lang;
-         }
+        if (locale != null) {
+            
+            String language = locale.getLanguage();
 
-         String country = locale.getCountry();
-         
-         if (country != null && !country.isEmpty())
-         {
-            if (id.isEmpty())
-            {
-               id = country;
+            if (language != null) {
+                identifier = language;
             }
-            else
-            {
-               id = id+"-"+country;
+
+            String country = locale.getCountry();
+
+            if ((country != null) &&
+                    (!"".equals(country))) {
+                
+                if ("".equals(identifier)) {
+                    identifier = country;
+                } else {
+                    identifier = identifier.concat("-").concat(country);
+                }
+                
             }
-         }
 
-         String codeset = System.getProperty("file.encoding");
+            String codeset = System.getProperty("file.encoding", "UTF-8");
 
-         if (codeset != null && !codeset.isEmpty())
-         {
-            if (convertCodeset)
-            {
-               codeset = codeset.toLowerCase().replaceAll("-", "");
+            if ((codeset != null) &&
+                    (!"".equals(codeset))) {
+                
+                if (convertCodeset) {
+                    codeset = codeset.toLowerCase().replaceAll("-", "");
+                }
+
+                identifier = identifier.concat(".").concat(codeset);
             }
 
-            id = id+"."+codeset;
-         }
+            String script = locale.getScript();
 
-         String script = locale.getScript();
+            if ((script != null) &&
+                    (!"".equals(script))) {
+                identifier = identifier.concat("@").concat(escapeHash(script));
+            }
 
-         if (script != null && !script.isEmpty())
-         {
-            id = id+"@"+escapeHash(script);
-         }
+        }
 
-      }
+        return identifier;
+    }
 
-      return id;
-   }
+    /**
+     * Gets the OS name.
+     * @return The OS name as string.
+     */
+    private static String getOSname() {
+        return getSystemProperty("os.name");
+    }
 
-   public static String getOSname()
-   {
-      try
-      {
-         return escapeHash(System.getProperty("os.name", ""));
-      }
-      catch (SecurityException e)
-      {
-         return "";
-      }
-   }
+    /**
+     * Gets the OS architecture.
+     * @return The OS architecture as string.
+     */
+    private static String getOSarch() {
+        return getSystemProperty("os.arch");
+    }
 
-   public static String getOSarch()
-   {
-      try
-      {
-         return escapeHash(System.getProperty("os.arch", ""));
-      }
-      catch (SecurityException e)
-      {
-         return "";
-      }
-   }
+    /**
+     * Gets the OS version.
+     * @return The OS version as string.
+     */
+    private static String getOSversion() {
+        return getSystemProperty("os.version");
+    }
 
-   public static String getOSversion()
-   {
-      try
-      {
-         return escapeHash(System.getProperty("os.version", ""));
-      }
-      catch (SecurityException e)
-      {
-         return "";
-      }
-   }
+    /**
+     * Gets the user home.
+     * @return The user home as string.
+     */
+    private static String getUserHome() {
+        return getSystemProperty("user.home");
+    }
 
-   public static String getUserHome()
-   {
-      try
-      {
-         return toTeXPath(System.getProperty("user.home", ""));
-      }
-      catch (SecurityException e)
-      {
-         return "";
-      }
-   }
+    /*
+   * 
+     */
+    /**
+     * Converts the filename string to TeX path. Since this is designed to work
+     * within TeX, backslashes in paths need to be replaced with forward
+     * slashes.
+     * @param filename The filename string.
+     * @return TeX path.
+     */
+    private static String toTeXPath(String filename) {
+        
+        String path = "";
+        
+        if (filename != null) {
+            if (File.separatorChar == BACKSLASH) {
+                filename = filename.replaceAll("\\\\", "/");
+            }
+            path = escapeHash(filename);
+        }
+        
+        return path;
+    }
 
-   /*
-   * Since this is designed to work within TeX, backslashes in paths
-   * need to be replaced with forward slashes.
-   */
+    /**
+     * Converts the TeX path back to the original representation.
+     * @param filename The filename string.
+     * @return The original representation.
+     */
+    private static String fromTeXPath(String filename) {
+        
+        if (File.separatorChar != FORWARDSLASH) {
+            filename = filename.replaceAll("/", File.separator);
+        }
 
-   public static String toTeXPath(String filename)
-   {
-      if (filename == null)
-      {
-         return "";
-      }
+        return filename;
+    }
 
-      if (File.separatorChar == '\\')
-      {
-         filename = filename.replaceAll("\\\\", "/");
-      }
+    /**
+     * Gets a file representation from a filename string.
+     * @param filename Filename string.
+     * @return File representation 
+     */
+    private static File fileFromTeXPath(String filename) {
+        
+        filename = fromTeXPath(filename);
+        File file = new File(filename);
 
-      return escapeHash(filename);
-   }
+        if (!file.exists() && file.getParent() == null) {
 
-   public static String fromTeXPath(String filename)
-   {
-      if (File.separatorChar != '/')
-      {
-         return filename.replaceAll("/", File.separator);
-      }
+            try {
+                Process process = new ProcessBuilder(
+                        "kpsewhich",
+                        filename
+                ).start();
 
-      return filename;
-   }
+                if (process.waitFor() == 0) {
+                
+                    InputStream stream = process.getInputStream();
+                    
+                    if (stream != null) {
+                        
+                        BufferedReader reader = new BufferedReader(
+                                new InputStreamReader(stream)
+                        );
 
-   public static File fileFromTeXPath(String filename)
-   {
-      filename = fromTeXPath(filename);
+                        String line = reader.readLine();
+                        reader.close();
 
-      File file = new File(filename);
+                        if ((line != null) && (!"".equals(line))) {
+                            file = new File(fromTeXPath(line));
+                        }
+                    }
+                }
+            } catch (IOException exception1) {
+                // quack quack
+            } catch (InterruptedException exception2) {
+                // quack quack
+            }
+        }
 
-      if (!file.exists() && file.getParent() == null)
-      {
-         // use kpsewhich to find it
+        return file;
+    }
 
-         try
-         {
-            Process p = new ProcessBuilder("kpsewhich", filename).start();
+    /**
+     * Gets the current working directory.
+     * @return The current working directory.
+     */
+    private static String getCwd() {
+        return getSystemProperty("user.dir");
+    }
 
-            if (p.waitFor() == 0)
-            {
-               InputStream is = p.getInputStream();
+    /**
+     * Gets the temporary directory.
+     * @return Temporary directory.
+     */
+    private static String getTmpDir() {
+        return getSystemProperty("java.io.tmpdir");
+    }
 
-               if (is != null)
-               {
-                  BufferedReader in = new BufferedReader(
-                     new InputStreamReader(is));
+    /**
+     * Gets the current date.
+     * @return The current date.
+     */
+    private static String pdfnow() {
+        return pdfDate(Calendar.getInstance());
+    }
 
-                  String line = in.readLine();
+    /**
+     * Gets the date in an specific format.
+     * @param calendar A calendar object.
+     * @return Date in an specific format.
+     */
+    private static String pdfDate(Calendar calendar) {
+        String tz = String.format("%1$tz", calendar);
+        return String.format(
+                "D:%1$tY%1$tm%1td%1$tH%1$tM%1$tS%2$s'%3$s'",
+                calendar,
+                tz.substring(0, 3),
+                tz.substring(3)
+        );
+    }
 
-                  in.close();
-
-                  if (line != null && !line.isEmpty())
-                  {
-                     file = new File(fromTeXPath(line));
-                  }
-               }
+    /**
+     * Gets the date from a file.
+     * @param file File.
+     * @return The date in an specific format.
+     */
+    private static String pdfDate(File file) {
+        
+        String date = "";
+        
+        try {
+            long millisecs = file.lastModified();
+            
+            if (millisecs > ZERO) {
+                
+                Calendar calendar = Calendar.getInstance();
+                calendar.setTimeInMillis(millisecs);
+                date = pdfDate(calendar);
+                
             }
-         }
-         catch (IOException e)
-         {
-         }
-         catch (InterruptedException e)
-         {
-         }
-      }
+        } catch (SecurityException exception) {
+            // quack quack
+        }
 
-      return file;
-   }
+        return date;
+    }
 
-   public static String getCwd()
-   {
-      try
-      {
-         return toTeXPath(System.getProperty("user.dir", ""));
-      }
-      catch (SecurityException e)
-      {
-         return "";
-      }
-   }
+    /**
+     * Gets the file length.
+     * @param file The file.
+     * @return The length as a string.
+     */
+    private static String getFileLength(File file) {
+        
+        String output = "";
+        
+        try {
+            long length = file.length();
 
-   public static String getTmpDir()
-   {
-      try
-      {
-         return toTeXPath(System.getProperty("java.io.tmpdir", ""));
-      }
-      catch (SecurityException e)
-      {
-         return "";
-      }
-   }
+            if (length > ZERO) {
+                output = String.format("%d", length);
+            }
+        } catch (SecurityException exception) {
+            // quack quack
+        }
 
-   public static String pdfnow()
-   {
-      Calendar cal = Calendar.getInstance();
+        return output;
+    }
 
-      return pdfDate(cal);
-   }
+    /**
+     * Gets the list of files from a directory.
+     * @param separator Separator.
+     * @param directory Directory.
+     * @return List as a string.
+     */
+    private static String getFileList(String separator, File directory) {
+        
+        StringBuilder builder = new StringBuilder();
+        
+        if (directory.isDirectory()) {
+        
+            try {
+                
+                String[] list = directory.list();
+                if (list != null) {
+                    
+                    for (int i = 0; i < list.length; i++) {
+                        
+                        if (i > 0) {
+                            builder.append(separator);
+                        }
+                        
+                        builder.append(escapeHash(list[i]));
+                        
+                    }
+                }
+                
+            } catch (SecurityException exception) {
+                // quack quack
+            }
+        }
 
-   public static String pdfDate(Calendar cal)
-   {
-      String tz = String.format("%1$tz", cal);
+        return builder.toString();
+    }
 
-      return String.format("D:%1$tY%1$tm%1td%1$tH%1$tM%1$tS%2$s'%3$s'", cal,
-         tz.substring(0,3), tz.substring(3)); 
-   }
+    /**
+     * Gets a filtered list of files from directory.
+     * @param separator Separator.
+     * @param regex Regular expression.
+     * @param directory Directory.
+     * @return Filtered list as string.
+     */
+    private static String getFilterFileList(String separator,
+            final String regex, File directory) {
+        
+        StringBuilder builder = new StringBuilder();
+        
+        if (directory.isDirectory()) {
+      
+            if ((regex == null) || ("".equals(regex))) {
+                builder.append(getFileList(separator, directory));
+            }
+            else {        
+                try {
+                    String[] list = directory.list(new FilenameFilter() {
+                        @Override
+                        public boolean accept(File dir, String name) {
+                            return name.matches(regex);
+                        }
+                    });
 
-   public static String pdfDate(File file)
-   {
-      try
-      {
-         long millisecs = file.lastModified();
+                    if (list != null) {
+                        
+                        for (int i = 0; i < list.length; i++) {
+                        
+                            if (i > 0) {
+                                builder.append(separator);
+                            }
+                            
+                            builder.append(escapeHash(list[i]));
+                        }
+                        
+                    }
+                } catch (SecurityException exception) {
+                    // quack quack
+                }
+            }
+        }
 
-         if (millisecs > 0L)
-         {
-            Calendar cal = Calendar.getInstance();
-            cal.setTimeInMillis(millisecs);
+        return builder.toString();
+    }
 
-            return pdfDate(cal);
-         }
-      }
-      catch (SecurityException e)
-      {
-      }
+    /**
+     * Gets the file URI.
+     * @param file The file.
+     * @return The URI.
+     */
+    private static String fileURI(File file) {
+        
+        String uri = "";
+        
+        if (file.exists()) {
+            try {
+                uri = file.toURI().toString();
+            } catch (SecurityException exception) {
+                // quack quack
+            }
+        }
 
-      return "";
-   }
+        return uri;
+    }
 
-   public static String getFileLength(File file)
-   {
-      try
-      {
-         long len = file.length();
+    /**
+     * Gets the file path.
+     * @param file The file.
+     * @return The path.
+     */
+    private static String filePath(File file) {
+        
+        String path = "";
+        
+        if (file.exists()) {
+            try {
+                path = toTeXPath(file.getCanonicalPath());
+            } catch (SecurityException exception1) {
+                // quack quack
+            } catch (IOException exception2) {
+                // quack quack
+            }
+        }
 
-         if (len > 0L)
-         {
-            return String.format("%d", len);
-         }
-      }
-      catch (SecurityException e)
-      {
-      }
+        return path;
+    }
 
-      return "";
-   }
+    /**
+     * Gets the path for the file's parent.
+     * @param file The file.
+     * @return The path.
+     */
+    private static String parentPath(File file) {
+        
+        String path = "";
+        
+        if (file.exists()) {
+            try {
+                path = toTeXPath(file.getCanonicalFile().getParent());
+            } catch (SecurityException exception1) {
+                // quack quack
+            } catch (IOException exception2) {
+                // quack quack
+            }
+        }
 
-   public static String getFileList(String sep, File dir)
-   {
-      if (!dir.isDirectory())
-      {
-         return "";
-      }
+        return path;
+    }
 
-      StringBuilder builder = new StringBuilder();
+    /**
+     * Prints the syntax usage.
+     */
+    private static void syntax() {
+        System.out.println("Usage: texosquery <option>...");
 
-      try
-      {
-         String[] list = dir.list();
+        System.out.println();
+        System.out.println("Cross-platform OS query application");
+        System.out.println("for use with TeX's shell escape.");
+        System.out.println();
+        System.out.println("Each query displays the result in a single line.");
+        System.out.println("A blank line is printed if the requested");
+        System.out.println("information is unavailable.");
 
-         if (list == null)
-         {
-            return "";
-         }
+        System.out.println();
+        System.out.println("-h or --help\tDisplay this help message and exit");
+        System.out.println("-v or --version\tDisplay version information and exit");
+        System.out.println();
+        System.out.println("General:");
+        System.out.println();
+        System.out.println("-L or --locale\t\tDisplay locale information");
+        System.out.println("-l or --locale-lcs\tAs --locale but codeset ");
+        System.out.println("\t\t\tin lowercase with hyphens stripped");
+        System.out.println("-c or --cwd\t\tDisplay current working directory");
+        System.out.println("-m or --userhome\tDisplay user's home directory");
+        System.out.println("-t or --tmpdir\t\tDisplay temporary directory");
+        System.out.println("-o or --osname\t\tDisplay OS name");
+        System.out.println("-r or --osversion\tDisplay OS version");
+        System.out.println("-a or --osarch\t\tDisplay OS architecture");
+        System.out.println("-n or --pdfnow\t\tDisplay current date-time in PDF format");
 
-         for (int i = 0; i < list.length; i++)
-         {
-            if (i > 0)
-            {
-               builder.append(sep);
-            }
+        System.out.println();
+        System.out.println("File Queries:");
+        System.out.println();
+        System.out.println("Paths should use / for the directory divider.");
+        System.out.println();
+        System.out.println("-d <file> or --pdfdate <file>");
+        System.out.println("  Display date stamp of <file> in PDF format");
+        System.out.println();
+        System.out.println("-s <file> or --filesize <file>");
+        System.out.println("  Display size of <file> in bytes");
+        System.out.println();
+        System.out.println("-i <sep> <dir> or --list <sep> <dir>");
+        System.out.println("  Display list of all files in <dir> separated by <sep>");
+        System.out.println();
+        System.out.println("-f <sep> <regex> <dir> or --filterlist <sep> <regex> <dir>");
+        System.out.println("  Display list of files in <dir> that match <regex> separated by <sep>");
+        System.out.println();
+        System.out.println("-u <file> or --uri <file>");
+        System.out.println("  Display the URI of <file>");
+        System.out.println();
+        System.out.println("-p <file> or --path <file>");
+        System.out.println("  Display the canonical path of <file>");
+        System.out.println();
+        System.out.println("-e <file> or --dirname <file>");
+        System.out.println("  Display the canonical path of the parent of <file>");
+    }
 
-            // no need to worry about directory divider
-            // File.list() just returns the name not the path
-            builder.append(escapeHash(list[i]));
-         }
-      }
-      catch (SecurityException e)
-      {
-      }
+    /**
+     * Prints the version.
+     */
+    private static void version() {
+        System.out.println(String.format("texosquery %s %s", VERSION_NUMBER,
+                VERSION_DATE));
+        System.out.println("Copyright 2016 Nicola Talbot");
+        System.out.println("License LPPL 1.3+ (http://ctan.org/license/lppl1.3)");
+    }
 
-      return builder.toString();
-   }
-
-   public static String getFilterFileList(String sep, 
-     final String regex, File dir)
+    /**
+     * Prints the information with optional grouping.
+     * @param group Determines whether to add grouping
+     * @param info Information to print
+     */ 
+   private static void print(boolean group, String info)
    {
-      if (!dir.isDirectory())
+      if (group)
       {
-         return "";
+         System.out.println(String.format("{%s}", info));
       }
-
-      if (regex == null || regex.isEmpty())
+      else
       {
-         return getFileList(sep, dir);
+         System.out.println(info);
       }
+   }
 
-      StringBuilder builder = new StringBuilder();
+    /**
+     * Main method.
+     * @param args Command line arguments.
+     */
+    public static void main(String[] args) {
+        if (args.length == 0) {
+            System.err.println("Missing argument. Try texosquery --help");
+            System.exit(1);
+        }
 
-      try
-      {
-         String[] list = dir.list(new FilenameFilter()
-         {
-            public boolean accept(File dir, String name)
-            {
-               return name.matches(regex);
-            }
-         });
+        boolean group = false;
 
-         if (list == null)
-         {
-            return "";
-         }
+        for (int i = 0, n=args.length-1; i < args.length; i++) {
+            if (args[i].equals("-L") || args[i].equals("--locale")) {
+                if (i < n) group = true;
 
-         for (int i = 0; i < list.length; i++)
-         {
-            if (i > 0)
-            {
-               builder.append(sep);
-            }
+                print(group, getLocale(Locale.getDefault()));
+            } else if (args[i].equals("-l") || args[i].equals("--locale-lcs")) {
+                if (i < n) group = true;
 
-            // no need to worry about directory divider
-            // File.list() just returns the name not the path
-            builder.append(escapeHash(list[i]));
-         }
-      }
-      catch (SecurityException e)
-      {
-      }
+                print(group, getLocale(Locale.getDefault(), true));
+            } else if (args[i].equals("-c") || args[i].equals("--cwd")) {
+                if (i < n) group = true;
 
-      return builder.toString();
-   }
+                print(group, getCwd());
+            } else if (args[i].equals("-m") || args[i].equals("--userhome")) {
+                if (i < n) group = true;
 
-   public static String fileURI(File file)
-   {
-      if (!file.exists())
-      {
-         return "";
-      }
+                print(group, getUserHome());
+            } else if (args[i].equals("-t") || args[i].equals("--tmpdir")) {
+                if (i < n) group = true;
 
-      try
-      {
-         // don't worry about '#' as it would've been converted to
-         // %23 (\TeXOSQuery changes the catcode of %)
-         return file.toURI().toString();
-      }
-      catch (SecurityException e)
-      {
-      }
+                print(group, getTmpDir());
+            } else if (args[i].equals("-r") || args[i].equals("--osversion")) {
+                if (i < n) group = true;
 
-      return "";
-   }
+                print(group, getOSversion());
+            } else if (args[i].equals("-a") || args[i].equals("--osarch")) {
+                if (i < n) group = true;
 
-   public static String filePath(File file)
-   {
-      if (!file.exists())
-      {
-         return "";
-      }
+                print(group, getOSarch());
+            } else if (args[i].equals("-o") || args[i].equals("--osname")) {
+                if (i < n) group = true;
 
-      try
-      {
-         return toTeXPath(file.getCanonicalPath());
-      }
-      catch (SecurityException e)
-      {
-      }
-      catch (IOException e)
-      {
-      }
+                print(group, getOSname());
+            } else if (args[i].equals("-n") || args[i].equals("--pdfnow")) {
+                if (i < n) group = true;
 
-      return "";
-   }
+                print(group, pdfnow());
+            } else if (args[i].equals("-d") || args[i].equals("--pdfdate")) {
+                i++;
 
-   public static void syntax()
-   {
-      System.out.println("Usage: texosquery <option>...");
+                if (i >= args.length) {
+                    System.err.println(
+                            String.format("filename expected after %s", args[i - 1]));
+                    System.exit(1);
+                }
 
-      System.out.println();
-      System.out.println("Cross-platform OS query application");
-      System.out.println("for use with TeX's shell escape.");
-      System.out.println();
-      System.out.println("Each query displays the result in a single line.");
-      System.out.println("A blank line is printed if the requested");
-      System.out.println("information is unavailable.");
+                if (i < n) group = true;
 
-      System.out.println();
-      System.out.println("-h or --help\tDisplay this help message and exit");
-      System.out.println("-v or --version\tDisplay version information and exit");
-      System.out.println();
-      System.out.println("General:");
-      System.out.println();
-      System.out.println("-L or --locale\t\tDisplay locale information");
-      System.out.println("-l or --locale-lcs\tAs --locale but codeset ");
-      System.out.println("\t\t\tin lowercase with hyphens stripped");
-      System.out.println("-c or --cwd\t\tDisplay current working directory");
-      System.out.println("-m or --userhome\tDisplay user's home directory");
-      System.out.println("-t or --tmpdir\t\tDisplay temporary directory");
-      System.out.println("-o or --osname\t\tDisplay OS name");
-      System.out.println("-r or --osversion\tDisplay OS version");
-      System.out.println("-a or --osarch\t\tDisplay OS architecture");
-      System.out.println("-n or --pdfnow\t\tDisplay current date-time in PDF format");
+                if ("".equals(args[i])) {
+                    print(group, "");
+                } else {
+                    print(group, pdfDate(fileFromTeXPath(args[i])));
+                }
+            } else if (args[i].equals("-s") || args[i].equals("--filesize")) {
+                i++;
 
-      System.out.println();
-      System.out.println("File Queries:");
-      System.out.println();
-      System.out.println("Paths should use / for the directory divider.");
-      System.out.println();
-      System.out.println("-d <file> or --pdfdate <file>");
-      System.out.println("  Display date stamp of <file> in PDF format");
-      System.out.println();
-      System.out.println("-s <file> or --filesize <file>");
-      System.out.println("  Display size of <file> in bytes");
-      System.out.println();
-      System.out.println("-i <sep> <dir> or --list <sep> <dir>");
-      System.out.println("  Display list of all files in <dir> separated by <sep>");
-      System.out.println();
-      System.out.println("-f <sep> <regex> <dir> or --filterlist <sep> <regex> <dir>");
-      System.out.println("  Display list of files in <dir> that match <regex> separated by <sep>");
-      System.out.println();
-      System.out.println("-u <file> or --uri <file>");
-      System.out.println("  Display the URI of <file>");
-      System.out.println();
-      System.out.println("-p <file> or --path <file>");
-      System.out.println("  Display the canonical path of <file>");
+                if (i >= args.length) {
+                    System.err.println(
+                            String.format("filename expected after %s", args[i - 1]));
+                    System.exit(1);
+                }
 
-   }
+                if (i < n) group = true;
 
-   public static void version()
-   {
-      System.out.println(String.format("texosquery %s %s", versionNum,
-       versionDate));
-      System.out.println("Copyright 2016 Nicola Talbot");
-      System.out.println("License LPPL 1.3+ (http://ctan.org/license/lppl1.3)");
-   }
+                if ("".equals(args[i])) {
+                    print(group, "");
+                } else {
+                    print(group, getFileLength(fileFromTeXPath(args[i])));
+                }
+            } else if (args[i].equals("-i") || args[i].equals("--list")) {
+                i++;
 
-   public static void main(String[] args)
-   {
-      if (args.length == 0)
-      {
-         System.err.println("Missing argument. Try texosquery --help");
-         System.exit(1);
-      }
+                if (i >= args.length) {
+                    System.err.println(
+                            String.format("separator and directory name expected after %s",
+                                    args[i - 1]));
+                    System.exit(1);
+                }
 
-      for (int i = 0; i < args.length; i++)
-      {
-         if (args[i].equals("-L") || args[i].equals("--locale"))
-         {
-            System.out.println(getLocale(Locale.getDefault()));
-         }
-         else if (args[i].equals("-l") || args[i].equals("--locale-lcs"))
-         {
-            System.out.println(getLocale(Locale.getDefault(), true));
-         }
-         else if (args[i].equals("-c") || args[i].equals("--cwd"))
-         {
-            System.out.println(getCwd());
-         }
-         else if (args[i].equals("-m") || args[i].equals("--userhome"))
-         {
-            System.out.println(getUserHome());
-         }
-         else if (args[i].equals("-t") || args[i].equals("--tmpdir"))
-         {
-            System.out.println(getTmpDir());
-         }
-         else if (args[i].equals("-r") || args[i].equals("--osversion"))
-         {
-            System.out.println(getOSversion());
-         }
-         else if (args[i].equals("-a") || args[i].equals("--osarch"))
-         {
-            System.out.println(getOSarch());
-         }
-         else if (args[i].equals("-o") || args[i].equals("--osname"))
-         {
-            System.out.println(getOSname());
-         }
-         else if (args[i].equals("-n") || args[i].equals("--pdfnow"))
-         {
-            System.out.println(pdfnow());
-         }
-         else if (args[i].equals("-d") || args[i].equals("--pdfdate"))
-         {
-            i++;
+                i++;
 
-            if (i >= args.length)
-            {
-               System.err.println(
-                 String.format("filename expected after %s", args[i-1]));
-               System.exit(1);
-            }
+                if (i >= args.length) {
+                    System.err.println(
+                            String.format("directory name expected after %s %s",
+                                    args[i - 2], args[i - 1]));
+                    System.exit(1);
+                }
 
-            if (args[i].isEmpty())
-            {
-               System.out.println();
-            }
-            else
-            {
-               System.out.println(pdfDate(fileFromTeXPath(args[i])));
-            }
-         }
-         else if (args[i].equals("-s") || args[i].equals("--filesize"))
-         {
-            i++;
+                if (i < n) group = true;
 
-            if (i >= args.length)
-            {
-               System.err.println(
-                 String.format("filename expected after %s", args[i-1]));
-               System.exit(1);
-            }
+                if ("".equals(args[i])) {
+                    print(group, "");
+                } else {
+                    print(group, getFileList(args[i - 1],
+                            new File(fromTeXPath(args[i]))));
+                }
+            } else if (args[i].equals("-f") || args[i].equals("--filterlist")) {
+                i++;
 
-            if (args[i].isEmpty())
-            {
-               System.out.println();
-            }
-            else
-            {
-               System.out.println(getFileLength(fileFromTeXPath(args[i])));
-            }
-         }
-         else if (args[i].equals("-i") || args[i].equals("--list"))
-         {
-            i++;
+                if (i >= args.length) {
+                    System.err.println(
+                            String.format(
+                                    "separator, regex and directory name expected after %s",
+                                    args[i - 1]));
+                    System.exit(1);
+                }
 
-            if (i >= args.length)
-            {
-               System.err.println(
-                 String.format("separator and directory name expected after %s",
-                   args[i-1]));
-               System.exit(1);
-            }
+                i++;
 
-            i++;
+                if (i >= args.length) {
+                    System.err.println(
+                            String.format("regex and directory name expected after %s %s",
+                                    args[i - 2], args[i - 1]));
+                    System.exit(1);
+                }
 
-            if (i >= args.length)
-            {
-               System.err.println(
-                 String.format("directory name expected after %s %s",
-                   args[i-2], args[i-1]));
-               System.exit(1);
-            }
+                i++;
 
-            if (args[i].isEmpty())
-            {
-               System.out.println();
-            }
-            else
-            {
-               System.out.println(getFileList(args[i-1],
-                  new File(fromTeXPath(args[i]))));
-            }
-         }
-         else if (args[i].equals("-f") || args[i].equals("--filterlist"))
-         {
-            i++;
+                if (i >= args.length) {
+                    System.err.println(
+                            String.format("directory name expected after %s %s",
+                                    args[i - 3], args[i - 2], args[i - 1]));
+                    System.exit(1);
+                }
 
-            if (i >= args.length)
-            {
-               System.err.println(
-                 String.format(
-                  "separator, regex and directory name expected after %s",
-                  args[i-1]));
-               System.exit(1);
-            }
+                if (i < n) group = true;
 
-            i++;
+                if ("".equals(args[i])) {
+                    print(group, "");
+                } else {
+                    print(group, getFilterFileList(
+                            args[i - 2], args[i - 1], new File(fromTeXPath(args[i]))));
+                }
+            } else if (args[i].equals("-u") || args[i].equals("--uri")) {
+                i++;
 
-            if (i >= args.length)
-            {
-               System.err.println(
-                 String.format("regex and directory name expected after %s %s",
-                   args[i-2], args[i-1]));
-               System.exit(1);
-            }
+                if (i >= args.length) {
+                    System.err.println(
+                            String.format("filename expected after %s", args[i - 1]));
+                    System.exit(1);
+                }
 
-            i++;
+                if (i < n) group = true;
 
-            if (i >= args.length)
-            {
-               System.err.println(
-                 String.format("directory name expected after %s %s",
-                   args[i-3], args[i-2], args[i-1]));
-               System.exit(1);
+                if ("".equals(args[i])) {
+                    print(group, "");
+                } else {
+                    print(group, fileURI(fileFromTeXPath(args[i])));
+                }
             }
-
-            if (args[i].isEmpty())
+            else if (args[i].equals("-p") || args[i].equals("--path"))
             {
-               System.out.println();
-            }
-            else
-            {
-               System.out.println(getFilterFileList(
-                args[i-2], args[i-1], new File(fromTeXPath(args[i]))));
-            }
-         }
-         else if (args[i].equals("-u") || args[i].equals("--uri"))
-         {
-            i++;
+                i++;
 
-            if (i >= args.length)
-            {
-               System.err.println(
-                 String.format("filename expected after %s", args[i-1]));
-               System.exit(1);
-            }
+                if (i >= args.length) {
+                    System.err.println(
+                            String.format("filename expected after %s", args[i - 1]));
+                    System.exit(1);
+                }
 
-            if (args[i].isEmpty())
-            {
-               System.out.println();
+                if (i < n) group = true;
+
+                if ("".equals(args[i])) {
+                    print(group, "");
+                } else {
+                    print(group, filePath(fileFromTeXPath(args[i])));
+                }
             }
-            else
+            else if (args[i].equals("-e") || args[i].equals("--dirname"))
             {
-               System.out.println(fileURI(fileFromTeXPath(args[i])));
-            }
-         }
-         else if (args[i].equals("-p") || args[i].equals("--path"))
-         {
-            i++;
+                i++;
 
-            if (i >= args.length)
-            {
-               System.err.println(
-                 String.format("filename expected after %s", args[i-1]));
-               System.exit(1);
-            }
+                if (i >= args.length) {
+                    System.err.println(
+                            String.format("filename expected after %s", args[i - 1]));
+                    System.exit(1);
+                }
 
-            if (args[i].isEmpty())
-            {
-               System.out.println();
+                if (i < n) group = true;
+
+                if ("".equals(args[i])) {
+                    print(group, "");
+                } else {
+                    print(group, 
+                     parentPath(fileFromTeXPath(args[i])));
+                }
             }
-            else
-            {
-               System.out.println(filePath(fileFromTeXPath(args[i])));
+            else if (args[i].equals("-h") || args[i].equals("--help")) {
+                syntax();
+                System.exit(0);
+            } else if (args[i].equals("-v") || args[i].equals("--version")) {
+                version();
+                System.exit(0);
+            } else {
+                System.err.println(String.format("unknown option '%s'", args[i]));
+                System.exit(1);
             }
-         }
-         else if (args[i].equals("-h") || args[i].equals("--help"))
-         {
-            syntax();
-            System.exit(0);
-         }
-         else if (args[i].equals("-v") || args[i].equals("--version"))
-         {
-            version();
-            System.exit(0);
-         }
-         else
-         {
-            System.err.println(String.format("unknown option '%s'", args[i]));
-            System.exit(1);
-         }
-      }
-   }
+        }
+    }
+    
+    /**
+     * Gets the system property.
+     * @param key Key.
+     * @return Value;
+     */
+    private static String getSystemProperty(String key) {
+        
+        String value = "";
+        
+        try {
+            value = System.getProperty(key, "");
+        }
+        catch (SecurityException exception) {
+            // quack quack
+        }
+        
+        return value;
+        
+    }
 
-   public static final String versionNum = "1.0";
-   public static final String versionDate = "2016-07-08";
 }

Modified: trunk/Master/texmf-dist/source/support/texosquery/texosquery.dtx
===================================================================
--- trunk/Master/texmf-dist/source/support/texosquery/texosquery.dtx	2016-07-14 21:41:30 UTC (rev 41700)
+++ trunk/Master/texmf-dist/source/support/texosquery/texosquery.dtx	2016-07-14 21:41:44 UTC (rev 41701)
@@ -30,7 +30,7 @@
 \usepackage{metalogo}
 \usepackage[colorlinks,hyperindex=false]{hyperref}
 
-\CheckSum{234}
+\CheckSum{269}
 
 \RecordChanges
 \PageIndex
@@ -61,8 +61,10 @@
 %\DeleteShortVerb{|}
 %
 %\title{texosquery: query OS information from \TeX}
-%\author{Nicola L. C. Talbot\\\url{http://www.dickimaw-books.com/}}
-%\date{2016-07-08 (v1.0)}
+%\author{Nicola L. C. Talbot\\
+%\href{http://www.dickimaw-books.com/}{\nolinkurl{dickimaw-books.com}}
+%\and Paulo Cereda}
+%\date{2016-07-14 (v1.1)}
 %\maketitle
 %
 %\begin{abstract}
@@ -81,6 +83,10 @@
 %installed to use \texttt{texosquery}.
 %\end{important}
 %
+%If you want to rebuild the application, instructions for
+%compiling the source code (including the code for this document)
+%are in the accompanying \texttt{README.md} file.
+%
 %\tableofcontents
 %
 %\section{texosquery.jar: the Java application}
@@ -99,10 +105,11 @@
 %
 %Since the application is designed to work with \TeX, each
 %function will display the result on a single line without
-%formatting. A blank line will be displayed if the information
-%isn't available. A forward slash is always used as a
-%directory divider, regardless of the operating system, so
-%the result can be used, for example, in \cs{input} or
+%formatting. (For multiple results, each line is grouped 
+%from v1.1.) A blank line (or empty group) will be displayed
+%if the information isn't available. A forward slash is always 
+%used as a directory divider, regardless of the operating 
+%system, so the result can be used, for example, in \cs{input} or
 %\cs{includegraphics}.
 %
 %If an input file name is required (for example, with the
@@ -193,8 +200,16 @@
 %using the shell escape, you'll need to be careful of this.
 %\item[\shortarg{p} \meta{file} or \longarg{path} \meta{file}]
 %Displays the canonical path of the given file or a blank line if
-%the file doesn't exists or the file permissions prohibit this
+%the file doesn't exist or the file permissions prohibit this
 %action.
+%\item[\shortarg{e} \meta{file} or \longarg{dirname} \meta{file}]
+%(New to v1.1.)
+%Displays the canonical path of the given file's parent (that is, the
+%directory containing \meta{file}) or a blank line if
+%the file doesn't exist or the file permissions prohibit this
+%action. Note that this is different to the Unix-like 
+%\texttt{dirname} command, which will return a relative path if
+%\meta{file} isn't an absolute path.
 %\item[\shortarg{h} or \longarg{help}] Displays help message and
 %exits.
 %\item[\shortarg{v} or \longarg{version}] Displays version
@@ -203,7 +218,41 @@
 %
 %If multiple options are given, they will be processed in the
 %order specified in the command line invocation. Each result will
-%be displayed on a separate line.
+%be displayed on a separate line. As from v1.1, if there are
+%multiple actions, each result will be grouped. This makes it easier
+%to process the results in \TeX. For example:
+%\begin{verbatim}
+%texosquery -l
+%\end{verbatim}
+%This just produces (for me):
+%\begin{verbatim}
+%en-GB.utf8
+%\end{verbatim}
+%whereas
+%\begin{verbatim}
+%texosquery -l -n
+%\end{verbatim}
+%produces:
+%\begin{verbatim}
+%{en-GB.utf8}
+%{D:20160714112732+01'00'}
+%\end{verbatim}
+%Note that unavailable information will produce an empty group.
+%For example (assuming \texttt{nofile} doesn't exist):
+%\begin{verbatim}
+%texosquery -l -d nofile -n
+%\end{verbatim}
+%produces:
+%\begin{verbatim}
+%{en-GB.utf8}
+%{}
+%{D:20160714112732+01'00'}
+%\end{verbatim}
+%whereas 
+%\begin{verbatim}
+%texosquery -d nofile
+%\end{verbatim}
+%just displays an empty line.
 %
 %\section{texosquery.tex: generic \TeX\ code}
 %You can run \texttt{texosquery} directly from \TeX's shell escape.
@@ -247,8 +296,8 @@
 %(\texttt{texosquery.jar} will replace \verb|#| with \verb|\#| in places
 %where it might possibly occur in the result, but in general it's
 %best to avoid these characters in file names.)
+%
 %There are some short cut commands for convenience, described below.
-%
 %If any of these commands cause an error message in the form:
 %\begin{verbatim}
 %I can't find file `|texosquery'.
@@ -280,9 +329,28 @@
 %TeXOSQuery:
 %\end{verbatim}
 %(the control sequence \meta{cs} will be set to empty).
-%This conditional will automatically be switched on if
-%\cs{shellescape} or \cs{pdfshellescape} is 0.
+%This conditional will automatically be switched on unless
+%\cs{shellescape} or \cs{pdfshellescape} is 1. (If
+%\texttt{texosquery.jar} is later allowed on the restricted list,
+%newer versions may change this default.)
 %
+%If multiple queries are required, it's more efficient to
+%perform them all in one go. For example:
+%\begin{verbatim}
+%\TeXOSQuery{\result}{-l -n -o}
+%
+%\def\parseresult#1#2#3{%
+%  Locale: #1. Now: #2. OS: #3.%
+%}
+%
+%\ifx\result\empty
+%  Query failed.
+%\else
+%  \expandafter\parseresult\result
+%\fi
+%\end{verbatim}
+%(Make sure you have at least v1.1 for this to work correctly.)
+%
 %The locale (\shortarg{l} or \longarg{locale-lcs}) information can be
 %obtained using:
 %\DescribeMacro\TeXOSQueryLocale
@@ -346,7 +414,9 @@
 %\end{flushleft}
 %This is provided for the benefit of users who don't have
 %\cs{pdfcreationdate} defined by their \TeX\ format (for example,
-%\XeTeX).
+%\XeTeX). As from v1.1, this ensures that the initial \texttt{D} has
+%category code 12 (which won't happen if \cs{TeXOSQuery} is used
+%explicitly).
 %
 %\begin{important}
 %The remaining commands all require extra arguments after the
@@ -373,7 +443,9 @@
 %\end{flushleft}
 %where \meta{filename} is the name of the file.
 %This is provided for the benefit of users who don't have
-%\cs{pdffilemoddate} defined by their \TeX\ format.
+%\cs{pdffilemoddate} defined by their \TeX\ format. As from v1.1,
+%this ensures that the initial \texttt{D} has category code 12 (which 
+%won't happen if \cs{TeXOSQuery} is used explicitly).
 %
 %The size in bytes of a file
 %(\shortarg{s} or \longarg{filesize}) can be obtained using:
@@ -436,6 +508,14 @@
 %\end{flushleft}
 %where \meta{filename} is the name of the file.
 %
+%The canonical path of a file's parent
+%(\shortarg{e} or \longarg{dirname}) can be obtained using:
+%\DescribeMacro\TeXOSQueryDirName
+%\begin{flushleft}\ttfamily
+%\cs{TeXOSQueryDirName}\marg{cs}\marg{filename}
+%\end{flushleft}
+%where \meta{filename} is the name of the file.
+%
 %\StopEventually{\phantomsection
 %\addcontentsline{toc}{section}{Change History}%
 %\PrintChanges
@@ -491,24 +571,26 @@
 %
 %\begin{macro}{\ifTeXOSQueryDryRun}
 %Provide a dry-run mode.
+%\changes{1.1}{2016-07-14}{dry run mode only false by default if with
+%unrestricted mode}
 %    \begin{macrocode}
 \newif\ifTeXOSQueryDryRun
-\TeXOSQueryDryRunfalse
+\TeXOSQueryDryRuntrue
 %    \end{macrocode}
 %\end{macro}
 %
-%If shell escape is disabled, automatically switch on dry-run mode.
+%If shell escape is unrestricted, automatically switch off dry-run mode.
 %    \begin{macrocode}
 \ifx\shellescape\undefined
   \ifx\pdfshellescape\undefined
   \else
-    \ifnum\pdfshellescape=0\relax
-      \TeXOSQueryDryRuntrue
+    \ifnum\pdfshellescape=1\relax
+      \TeXOSQueryDryRunfalse
     \fi
   \fi
 \else
-  \ifnum\shellescape=0\relax
-    \TeXOSQueryDryRuntrue
+  \ifnum\shellescape=1\relax
+    \TeXOSQueryDryRunfalse
   \fi
 \fi
 %    \end{macrocode}
@@ -608,10 +690,25 @@
 %\end{macro}
 %
 %\begin{macro}{\TeXOSQueryNow}
+%\changes{1.1}{2016-07-14}{changed catcode of D to 12}
 %Query the current time stamp.
 %    \begin{macrocode}
-\def\TeXOSQueryNow#1{\TeXOSQuery{#1}{\string-n}}
+\def\TeXOSQueryNow#1{%
 %    \end{macrocode}
+% The \texttt{D} needs category code 12. (Don't need to worry about
+% \texttt{Z} as \texttt{texosquery.jar} uses \texttt{+00'00'} for
+% UTC+0.) This change can't be done with the other catcode changes
+% in \cs{TeXOSQuery}, as this is only appropriate for the PDF dates.
+% Save and restore the catcode rather than fiddle around with
+% scoping.
+%    \begin{macrocode}
+  \edef\@texosquery at restore@D{%
+    \noexpand\catcode`\noexpand\D=\the\catcode`\D\relax}%
+  \catcode`\D=12\relax
+  \TeXOSQuery{#1}{\string-n}%
+  \@texosquery at restore@D
+}
+%    \end{macrocode}
 %\end{macro}
 %
 %If the file name is supplied using \cs{jobname} it may have
@@ -632,10 +729,16 @@
 %\end{macro}
 %
 %\begin{macro}{\TeXOSQueryFileDate}
+%\changes{1.1}{2016-07-14}{changed catcode of D to 12}
 %Query the time stamp of the file given in the second argument.
 %    \begin{macrocode}
-\def\TeXOSQueryFileDate#1#2{\TeXOSQuery{#1}{\string-d 
-  \string'\texosquerystripquotes{#2}\string'}}
+\def\TeXOSQueryFileDate#1#2{%
+  \edef\@texosquery at restore@D{%
+    \noexpand\catcode`\noexpand\D=\the\catcode`\D\relax}%
+  \catcode`\D=12\relax
+  \TeXOSQuery{#1}{\string-d \string'\texosquerystripquotes{#2}\string'}%
+  \@texosquery at restore@D
+}
 %    \end{macrocode}
 %\end{macro}
 %
@@ -685,6 +788,16 @@
 %    \end{macrocode}
 %\end{macro}
 %
+%\begin{macro}{\TeXOSQueryDirName}
+%\changes{1.1}{2016-07-14}{new}
+%Get the canonical path of the directory containing the file given 
+%in the second argument.
+%    \begin{macrocode}
+\def\TeXOSQueryDirName#1#2{\TeXOSQuery{#1}{\string-e 
+ \string'\texosquerystripquotes{#2}\string'}}
+%    \end{macrocode}
+%\end{macro}
+%
 %All done.
 %Restore the category code of \texttt{@}:
 %    \begin{macrocode}
@@ -708,7 +821,7 @@
 %Identify package:
 %    \begin{macrocode}
 \NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{texosquery}[2016/07/08 v1.0 (NLCT)]
+\ProvidesPackage{texosquery}[2016/07/14 v1.1 (NLCT)]
 %    \end{macrocode}
 %Load \texttt{texosquery.tex}:
 %    \begin{macrocode}

Modified: trunk/Master/texmf-dist/tex/latex/texosquery/texosquery.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/texosquery/texosquery.sty	2016-07-14 21:41:30 UTC (rev 41700)
+++ trunk/Master/texmf-dist/tex/latex/texosquery/texosquery.sty	2016-07-14 21:41:44 UTC (rev 41701)
@@ -41,7 +41,7 @@
 %%   Grave accent  \`     Left brace    \{     Vertical bar  \|
 %%   Right brace   \}     Tilde         \~}
 \NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{texosquery}[2016/07/08 v1.0 (NLCT)]
+\ProvidesPackage{texosquery}[2016/07/14 v1.1 (NLCT)]
 \input{texosquery}
 \endinput
 %%

Modified: trunk/Master/texmf-dist/tex/latex/texosquery/texosquery.tex
===================================================================
--- trunk/Master/texmf-dist/tex/latex/texosquery/texosquery.tex	2016-07-14 21:41:30 UTC (rev 41700)
+++ trunk/Master/texmf-dist/tex/latex/texosquery/texosquery.tex	2016-07-14 21:41:44 UTC (rev 41701)
@@ -60,17 +60,17 @@
   \def\TeXOSQueryInvoker#1{\@@input|"\TeXOSInvokerName\space#1" }
 \fi
 \newif\ifTeXOSQueryDryRun
-\TeXOSQueryDryRunfalse
+\TeXOSQueryDryRuntrue
 \ifx\shellescape\undefined
   \ifx\pdfshellescape\undefined
   \else
-    \ifnum\pdfshellescape=0\relax
-      \TeXOSQueryDryRuntrue
+    \ifnum\pdfshellescape=1\relax
+      \TeXOSQueryDryRunfalse
     \fi
   \fi
 \else
-  \ifnum\shellescape=0\relax
-    \TeXOSQueryDryRuntrue
+  \ifnum\shellescape=1\relax
+    \TeXOSQueryDryRunfalse
   \fi
 \fi
 \def\TeXOSQuery#1#2{%
@@ -107,7 +107,13 @@
 \def\TeXOSQueryVersion#1{\TeXOSQuery{#1}{\string-r}}
 \def\TeXOSQueryArch#1{\TeXOSQuery{#1}{\string-a}}
 \def\TeXOSQueryName#1{\TeXOSQuery{#1}{\string-o}}
-\def\TeXOSQueryNow#1{\TeXOSQuery{#1}{\string-n}}
+\def\TeXOSQueryNow#1{%
+  \edef\@texosquery at restore@D{%
+    \noexpand\catcode`\noexpand\D=\the\catcode`\D\relax}%
+  \catcode`\D=12\relax
+  \TeXOSQuery{#1}{\string-n}%
+  \@texosquery at restore@D
+}
 \def\texosquerystripquotes#1{%
   \@texosquery at stripquotes#1\@mid at texosquery@stripquotes
     "\relax"\relax\@end at texosquery@stripquotes
@@ -118,8 +124,13 @@
 \def\@@texosquery at stripquotes#1\@mid at texosquery@stripquotes#2\@end at texosquery@stripquotes{%
   #1%
 }
-\def\TeXOSQueryFileDate#1#2{\TeXOSQuery{#1}{\string-d
-  \string'\texosquerystripquotes{#2}\string'}}
+\def\TeXOSQueryFileDate#1#2{%
+  \edef\@texosquery at restore@D{%
+    \noexpand\catcode`\noexpand\D=\the\catcode`\D\relax}%
+  \catcode`\D=12\relax
+  \TeXOSQuery{#1}{\string-d \string'\texosquerystripquotes{#2}\string'}%
+  \@texosquery at restore@D
+}
 \def\TeXOSQueryFileSize#1#2{\TeXOSQuery{#1}{\string-s
  \string'\texosquerystripquotes{#2}\string'}}
 \def\TeXOSQueryFileList#1#2#3{\TeXOSQuery{#1}{%
@@ -132,6 +143,8 @@
  \string'\texosquerystripquotes{#2}\string'}}
 \def\TeXOSQueryFilePath#1#2{\TeXOSQuery{#1}{\string-p
  \string'\texosquerystripquotes{#2}\string'}}
+\def\TeXOSQueryDirName#1#2{\TeXOSQuery{#1}{\string-e
+ \string'\texosquerystripquotes{#2}\string'}}
 \@texosquery at restore@at
 \endinput
 %%



More information about the tex-live-commits mailing list