Procházet zdrojové kódy

Convert 822-date to be a simple wrapper around 'date -R'. 822-date is
now deprecated and should not be used anymore. It might be removed
sometime in the future. Closes: #31634, #367712, #314462
Thanks to Frank Lichtenheld.

Guillem Jover před 19 roky
rodič
revize
b6c1a04204
5 změnil soubory, kde provedl 42 přidání a 61 odebrání
  1. 5 0
      ChangeLog
  2. 4 0
      debian/changelog
  3. 18 13
      man/822-date.1
  4. 5 0
      man/ChangeLog
  5. 10 48
      scripts/822-date.pl

+ 5 - 0
ChangeLog

@@ -1,3 +1,8 @@
+2007-01-24  Frank Lichtenheld  <djpig@debian.org>
+
+	* scripts/822-date.pl: Convert the script to be a simple wrapper
+	around 'date -R'.
+
 2007-01-23  Sven Joachim  <sven_joachim@web.de>
 	    Guillem Jover  <guillem@debian.org>
 

+ 4 - 0
debian/changelog

@@ -18,6 +18,10 @@ dpkg (1.14.0) UNRELEASED; urgency=low
     create directories when extracting the diff. Closes: #374645
   * Fix up and down keystrokes in the dselect help message. Closes: #383438
     Thanks to Sven Joachim.
+  * Convert 822-date to be a simple wrapper around 'date -R'. 822-date is
+    now deprecated and should not be used anymore. It might be removed
+    sometime in the future. Closes: #31634, #367712, #314462
+    Thanks to Frank Lichtenheld.
 
   [ Updated dpkg translations ]
   * Romanian (Eddy Petrișor).

+ 18 - 13
man/822-date.1

@@ -1,16 +1,21 @@
 .\" Hey, Emacs!  This is an -*- nroff -*- source file.
-.\" Authors: Ian Jackson
-.TH 822\-date 1 "2006-02-28" "Debian Project" "dpkg utilities"
+.TH 822\-date 1 "2007-01-24" "Debian Project" "dpkg utilities"
 .SH NAME
-822\-date \- Print date and time in RFC822 format
+822\-date \- Print date and time in RFC2822 format
 .
 .SH SYNOPSIS
 .B 822\-date
 .
 .SH DESCRIPTION
 .B 822\-date
-displays the current date and time in the format described in RFC822,
-using a numeric timezone offset as recommended in RFC1123.
+displays the current date and time in the format described in RFC2822.
+It does so by simply calling
+.BR date (1)
+with the \fB\-R\fP option.
+.PP
+.B Using 822\-date is deprecated since
+.BR date (1)
+provides the same functionality when called with the \fB\-R\fP.
 .
 .SH OPTIONS
 .B 822\-date
@@ -21,15 +26,15 @@ This facility really ought to be part of
 .BR date (1).
 .
 .SH SEE ALSO
-.I Standard for the Format of ARPA Internet Text Messages
-(RFC822),
-.br
-.I Requirements for Internet Hosts -- Application and Support
-(RFC1123) section 5.2.14,
-.br
+.I Internet Message Format
+(RFC2822),
 .BR date (1).
 .
 .SH AUTHOR
 .B 822\-date
-and this manpage were written by Ian Jackson. They are hereby placed
-by him into the public domain.
+is a really simple wrapper around
+.BR date (1).
+By its simplicity, the code is probably not copyrightable and
+should be considered to be in the public domain. This man page
+was written by Frank Lichtenheld based on an earlier version
+by Ian Jackson and was also put in the public domain.

+ 5 - 0
man/ChangeLog

@@ -1,3 +1,8 @@
+2007-01-24  Frank Lichtenheld  <djpig@debian.org>
+
+	* 822-date.1: 822-date is now deprecated. Document this fact in
+	the man page.
+
 2007-01-16  Nicolas Francois  <nicolas.francois@centraliens.net>
 
 	* po/add_fr/dselect.cfg.5.fr.add: New translated man page.

+ 10 - 48
scripts/822-date.pl

@@ -1,56 +1,18 @@
 #!/usr/bin/perl --
-# I hereby place this in the public domain - Ian Jackson, 1995.
-# Changes by Klee Dienes also placed in public domain (1997). 
 
-# time structure:
-# [ sec min hour mday mon year wday yday isdst ]
+use strict;
+use warnings;
 
-@ARGV && die "usage: 822-date\n";
+my $dpkglibdir = "."; # This line modified by Makefile
+push(@INC, $dpkglibdir);
+require 'dpkg-gettext.pl';
+textdomain("dpkg-dev");
 
-$curtime = time;
-@localtm = localtime ($curtime);
-$localtms = localtime ($curtime);
-@gmttm = gmtime ($curtime);
-$gmttms = gmtime ($curtime);
+require 'controllib.pl';
 
-if ($localtm[0] != $gmttm[0]) {
-    die (sprintf ("local timezone differs from GMT by a non-minute interval\n"
-		 . "local time: %s\n"
-		 . "GMT time: %s\n", $localtms, $gmttms));
-}
+@ARGV && die _g("Usage: 822-date")."\n";
 
-$localmin = $localtm[1] + $localtm[2] * 60;
-$gmtmin = $gmttm[1] + $gmttm[2] * 60;
+&warn(_g("This program is deprecated. Please use 'date -R' instead."));
 
-if ((($gmttm[6] + 1) % 7) == $localtm[6]) {
-    $localmin += 1440;
-} elsif ((($gmttm[6] - 1) % 7) == $localtm[6]) {
-    $localmin -= 1440;
-} elsif ($gmttm[6] == $localtm[6]) {
-    1;
-} else {
-    die ("822-date: local time offset greater than or equal to 24 hours\n");
-}
+print `date -R`;
 
-$offset = $localmin - $gmtmin;
-$offhour = $offset / 60;
-$offmin = abs ($offset % 60);
-
-if (abs ($offhour) >= 24) { 
-    die ("822-date: local time offset greater than or equal to 24 hours\n");
-}
-
-printf 
-    (
-     "%s, %2d %s %d %02d:%02d:%02d %s%02d%02d\n",
-     (Sun,Mon,Tue,Wed,Thu,Fri,Sat)[$localtm[6]], # day of week
-     $localtm[3],		# day of month
-     (Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec)[$localtm[4]], # month
-     $localtm[5]+1900,		# year
-     $localtm[2],		# hour
-     $localtm[1],		# minute
-     $localtm[0],		# sec
-     ($offset >= 0) ? '+' : '-',# TZ offset direction
-     abs ($offhour),		# TZ offset hour
-     $offmin,			# TZ offset minute
-     ) || die "822-date: output error: $!\n";