]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - systemv/lpstat.c
Remove svn:keywords since they cause svn_load_dirs.pl to complain about every file.
[thirdparty/cups.git] / systemv / lpstat.c
index bce318bc1d7fbf41ee5146012ec3642af4909395..316617382989d3e1febdf45b1a9e8c3f114970ed 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: lpstat.c 5331 2006-03-23 21:21:19Z mike $"
+ * "$Id: lpstat.c 181 2006-06-22 20:01:18Z jlovell $"
  *
  *   "lpstat" command for the Common UNIX Printing System (CUPS).
  *
@@ -42,6 +42,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <errno.h>
+#include <cups/http-private.h>
 #include <cups/string.h>
 #include <cups/cups.h>
 #include <cups/i18n.h>
@@ -70,26 +71,59 @@ static void show_scheduler(http_t *);
  */
 
 int
-main(int  argc,                        /* I - Number of command-line arguments */
-     char *argv[])             /* I - Command-line arguments */
+main(int  argc,                                /* I - Number of command-line arguments */
+     char *argv[])                     /* I - Command-line arguments */
 {
-  int          i,              /* Looping var */
-               status;         /* Exit status */
-  http_t       *http;          /* Connection to server */
-  int          num_dests;      /* Number of user destinations */
-  cups_dest_t  *dests;         /* User destinations */
-  int          long_status;    /* Long status report? */
-  int          ranking;        /* Show job ranking? */
-  const char   *which;         /* Which jobs to show? */
-  char         op;             /* Last operation on command-line */
+  int          i,                      /* Looping var */
+               status;                 /* Exit status */
+  http_t       *http;                  /* Connection to server */
+  int          num_dests;              /* Number of user destinations */
+  cups_dest_t  *dests;                 /* User destinations */
+  int          long_status;            /* Long status report? */
+  int          ranking;                /* Show job ranking? */
+  const char   *which;                 /* Which jobs to show? */
+  char         op;                     /* Last operation on command-line */
 
 
  /*
   * Set the locale so that times, etc. are displayed properly.
+  *
+  * Unfortunately, while we need the localized time value, we *don't*
+  * want to use the localized charset for the time value, so we need
+  * to set LC_TIME to the locale name with .UTF-8 on the end (if
+  * the locale includes a character set specifier...)
   */
 
   setlocale(LC_ALL, "");
 
+#ifdef LC_TIME
+  {
+    const char *lc_time;               /* Current LC_TIME value */
+    char       new_lc_time[255],       /* New LC_TIME value */
+               *charset;               /* Pointer to character set */
+
+    if ((lc_time = setlocale(LC_TIME, NULL)) == NULL)
+      lc_time = setlocale(LC_ALL, NULL);
+
+    if (lc_time)
+    {
+      strlcpy(new_lc_time, lc_time, sizeof(new_lc_time));
+      if ((charset = strchr(new_lc_time, '.')) == NULL)
+        charset = new_lc_time + strlen(new_lc_time);
+
+      strlcpy(charset, ".UTF-8", sizeof(new_lc_time) - (charset - new_lc_time));
+    }
+    else
+      strcpy(new_lc_time, "C");
+
+    setlocale(LC_TIME, new_lc_time);
+  }
+#endif /* LC_TIME */
+  
+ /*
+  * Parse command-line options...
+  */
+
   http        = NULL;
   num_dests   = 0;
   dests       = NULL;
@@ -235,10 +269,10 @@ main(int  argc,                   /* I - Number of command-line arguments */
            }
            else
            {
-             _cupsLangPuts(stderr,
-                           _("%s: Error - expected destination after "
-                             "\'-b\' option!\n"),
-                           argv[0]);
+             _cupsLangPrintf(stderr,
+                             _("%s: Error - expected destination after "
+                               "\'-b\' option!\n"),
+                             argv[0]);
 
              return (1);
            }
@@ -2248,5 +2282,5 @@ show_scheduler(http_t *http)      /* I - HTTP connection to server */
 
 
 /*
- * End of "$Id: lpstat.c 5331 2006-03-23 21:21:19Z mike $".
+ * End of "$Id: lpstat.c 181 2006-06-22 20:01:18Z jlovell $".
  */