diff options
author | Christian Neukirchen <chneukirchen@gmail.com> | 2016-01-22 18:43:14 +0100 |
---|---|---|
committer | Christian Neukirchen <chneukirchen@gmail.com> | 2016-01-22 18:43:14 +0100 |
commit | 372fdabc1fcb5eda5a90a05da3d9f9b3b5857ba5 (patch) | |
tree | 6bb3109b362610f3024cff3e42a946d154737f20 | |
parent | 193f150ac3a87fad164b3911bb69280b0728f6f1 (diff) | |
download | outils-372fdabc1fcb5eda5a90a05da3d9f9b3b5857ba5.tar.gz outils-372fdabc1fcb5eda5a90a05da3d9f9b3b5857ba5.tar.xz outils-372fdabc1fcb5eda5a90a05da3d9f9b3b5857ba5.zip |
cvs update
-rw-r--r-- | Makefile | 8 | ||||
-rw-r--r-- | src/usr.bin/calendar/calendar.1 | 12 | ||||
-rw-r--r-- | src/usr.bin/calendar/calendar.c | 20 | ||||
-rw-r--r-- | src/usr.bin/calendar/calendar.h | 9 | ||||
-rw-r--r-- | src/usr.bin/calendar/calendars/calendar.all | 4 | ||||
-rw-r--r-- | src/usr.bin/calendar/calendars/calendar.holiday | 11 | ||||
-rw-r--r-- | src/usr.bin/calendar/calendars/calendar.music | 3 | ||||
-rw-r--r-- | src/usr.bin/calendar/calendars/calendar.nz | 48 | ||||
-rw-r--r-- | src/usr.bin/calendar/day.c | 35 | ||||
-rw-r--r-- | src/usr.bin/calendar/io.c | 14 | ||||
-rw-r--r-- | src/usr.bin/jot/Makefile | 4 | ||||
-rw-r--r-- | src/usr.bin/jot/jot.1 | 11 | ||||
-rw-r--r-- | src/usr.bin/jot/jot.c | 44 | ||||
-rw-r--r-- | src/usr.bin/lam/lam.1 | 11 | ||||
-rw-r--r-- | src/usr.bin/rs/Makefile | 4 | ||||
-rw-r--r-- | src/usr.bin/rs/rs.1 | 24 | ||||
-rw-r--r-- | src/usr.bin/rs/rs.c | 153 | ||||
-rw-r--r-- | src/usr.bin/signify/signify.1 | 8 | ||||
-rw-r--r-- | src/usr.bin/signify/signify.c | 7 |
19 files changed, 279 insertions, 151 deletions
diff --git a/Makefile b/Makefile index 2eb90a3..987387a 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ CFLAGS=-Wall -O2 CPPFLAGS=-include src/liboutils/outils.h -isystem src/liboutils/include -Isrc/bin/md5 -D_GNU_SOURCE -D_DEFAULT_SOURCE -DNO_UTIL -LDFLAGS=-Wl,--as-needed -lcrypto +LDFLAGS=-Wl,--as-needed -lcrypto -lm %: %.o $(CC) -o $@ $^ $(LDFLAGS) @@ -10,7 +10,7 @@ all: $(ALL) src/usr.bin/apply/apply: src/usr.bin/apply/apply.o src/liboutils/pledge.o src/liboutils/strlcpy.o -src/usr.bin/jot/jot: src/usr.bin/jot/jot.o src/liboutils/strlcpy.o src/liboutils/strlcat.o src/liboutils/strtonum.o src/liboutils/arc4random.o src/liboutils/getentropy_linux.o src/liboutils/explicit_bzero.o src/liboutils/pledge.o src/liboutils/sha512.o src/liboutils/mem_clr.o +src/usr.bin/jot/jot: src/usr.bin/jot/jot.o src/liboutils/strlcpy.o src/liboutils/strlcat.o src/liboutils/strtonum.o src/liboutils/arc4random.o src/liboutils/arc4random_uniform.o src/liboutils/getentropy_linux.o src/liboutils/explicit_bzero.o src/liboutils/pledge.o src/liboutils/sha512.o src/liboutils/mem_clr.o src/usr.bin/lam/lam: src/usr.bin/lam/lam.o src/liboutils/pledge.o src/liboutils/strlcpy.o @@ -18,11 +18,11 @@ src/usr.bin/lndir/lndir: src/usr.bin/lndir/lndir.o src/liboutils/pledge.o src/li src/bin/md5/md5: src/bin/md5/md5.o src/bin/md5/crc.o src/liboutils/sha512.o src/liboutils/mem_clr.o src/liboutils/explicit_bzero.o src/liboutils/md5.o src/liboutils/pledge.o src/liboutils/rmd160.o src/liboutils/sha1.o src/liboutils/sha2.o src/liboutils/fgetln.o src/liboutils/base64.o src/liboutils/md5hl.o src/liboutils/rmd160hl.o src/liboutils/sha1hl.o src/liboutils/sha224hl.o src/liboutils/sha256hl.o src/liboutils/sha384hl.o src/liboutils/sha512hl.o -src/usr.bin/rs/rs: src/usr.bin/rs/rs.o src/liboutils/pledge.o src/liboutils/strtonum.o src/liboutils/reallocarray.c +src/usr.bin/rs/rs: src/usr.bin/rs/rs.o src/usr.bin/rs/utf8.o src/liboutils/pledge.o src/liboutils/strtonum.o src/liboutils/reallocarray.c src/usr.bin/signify/signify: src/usr.bin/signify/signify.o src/usr.bin/signify/crypto_api.o src/usr.bin/signify/fe25519.o src/usr.bin/signify/mod_ed25519.o src/usr.bin/signify/mod_ge25519.o src/usr.bin/signify/sc25519.o src/usr.bin/signify/smult_curve25519_ref.o src/liboutils/pledge.o src/liboutils/strlcpy.o src/liboutils/base64.o src/liboutils/explicit_bzero.o src/liboutils/ohash.o src/liboutils/arc4random.o src/liboutils/getentropy_linux.o src/liboutils/readpassphrase.o src/liboutils/sha2.o src/liboutils/sha256hl.o src/liboutils/sha512hl.o src/liboutils/timingsafe_bcmp.o src/liboutils/bcrypt_pbkdf.o src/liboutils/blowfish.o -src/usr.bin/calendar/calendar: src/usr.bin/calendar/calendar.o src/usr.bin/calendar/day.o src/usr.bin/calendar/io.o src/usr.bin/calendar/ostern.o src/usr.bin/calendar/paskha.o src/usr.bin/calendar/pesach.o src/liboutils/arc4random_uniform.o src/liboutils/arc4random.o src/liboutils/getentropy_linux.o src/liboutils/explicit_bzero.o src/liboutils/sha2.o src/liboutils/strtonum.o +src/usr.bin/calendar/calendar: src/usr.bin/calendar/calendar.o src/usr.bin/calendar/day.o src/usr.bin/calendar/io.o src/usr.bin/calendar/ostern.o src/usr.bin/calendar/paskha.o src/usr.bin/calendar/pesach.o src/liboutils/arc4random_uniform.o src/liboutils/arc4random.o src/liboutils/getentropy_linux.o src/liboutils/explicit_bzero.o src/liboutils/pledge.o src/liboutils/sha2.o src/liboutils/strtonum.o src/usr.bin/gzsig/gzsig: src/usr.bin/gzsig/gzsig.o src/usr.bin/gzsig/key.o src/usr.bin/gzsig/sign.o src/usr.bin/gzsig/ssh.o src/usr.bin/gzsig/ssh2.o src/usr.bin/gzsig/util.o src/usr.bin/gzsig/verify.o src/usr.bin/gzsig/x509.o src/liboutils/strlcpy.o src/liboutils/base64.o src/liboutils/sha1.o diff --git a/src/usr.bin/calendar/calendar.1 b/src/usr.bin/calendar/calendar.1 index f0a9596..a270eee 100644 --- a/src/usr.bin/calendar/calendar.1 +++ b/src/usr.bin/calendar/calendar.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: calendar.1,v 1.39 2015/10/23 11:01:30 zhuk Exp $ +.\" $OpenBSD: calendar.1,v 1.42 2016/01/20 19:12:28 jmc Exp $ .\" .\" Copyright (c) 1989, 1990, 1993 .\" The Regents of the University of California. All rights reserved. @@ -29,7 +29,7 @@ .\" .\" @(#)calendar.1 8.1 (Berkeley) 6/29/93 .\" -.Dd $Mdocdate: October 23 2015 $ +.Dd $Mdocdate: January 20 2016 $ .Dt CALENDAR 1 .Os .Sh NAME @@ -37,7 +37,7 @@ .Nd reminder service .Sh SYNOPSIS .Nm calendar -.Op Fl ab +.Op Fl abw .Op Fl A Ar num .Op Fl B Ar num .Op Fl f Ar calendarfile @@ -82,6 +82,8 @@ instead of using the current date. If yy is specified, but cc is not, a value for yy between 69 and 99 results in a cc value of 19. Otherwise, a cc value of 20 is used. +.It Fl w +Print day of the week name in front of each event. .El .Pp To handle calendars in your national code table you can specify @@ -226,6 +228,8 @@ Jewish holidays (should be updated yearly by the local system administrator so that roving holidays are set correctly for the current year). .It Pa calendar.music Musical events, births, and deaths (strongly oriented toward rock n' roll). +.It Pa calendar.nz +New Zealand calendar. .It Pa calendar.openbsd .Ox related events. @@ -235,6 +239,8 @@ Pagan holidays, celebrations and festivals. Russian calendar. .It Pa calendar.space Cosmic history. +.It Pa calendar.uk +UK calendar. .It Pa calendar.ushistory U.S. history. .It Pa calendar.usholiday diff --git a/src/usr.bin/calendar/calendar.c b/src/usr.bin/calendar/calendar.c index 094001f..547ba08 100644 --- a/src/usr.bin/calendar/calendar.c +++ b/src/usr.bin/calendar/calendar.c @@ -1,4 +1,4 @@ -/* $OpenBSD: calendar.c,v 1.32 2015/10/23 11:43:16 zhuk Exp $ */ +/* $OpenBSD: calendar.c,v 1.35 2015/12/07 18:46:35 espie Exp $ */ /* * Copyright (c) 1989, 1993, 1994 @@ -53,6 +53,7 @@ char *calendarNoMail = "nomail"; /* don't sent mail if this file exists */ struct passwd *pw; int doall = 0; +int daynames = 0; time_t f_time = 0; int bodun_always = 0; @@ -73,7 +74,7 @@ main(int argc, char *argv[]) (void)setlocale(LC_ALL, ""); - while ((ch = getopt(argc, argv, "abf:t:A:B:-")) != -1) + while ((ch = getopt(argc, argv, "abwf:t:A:B:-")) != -1) switch (ch) { case '-': /* backward contemptible */ case 'a': @@ -108,6 +109,10 @@ main(int argc, char *argv[]) errx(1, "-B %s: %s", optarg, errstr); break; + case 'w': + daynames = 1; + break; + default: usage(); } @@ -117,6 +122,15 @@ main(int argc, char *argv[]) if (argc) usage(); + if (doall) { + if (pledge("stdio rpath tmppath fattr getpw id proc exec", NULL) + == -1) + err(1, "pledge"); + } else { + if (pledge("stdio rpath proc exec", NULL) == -1) + err(1, "pledge"); + } + /* use current time */ if (f_time <= 0) (void)time(&f_time); @@ -249,7 +263,7 @@ void usage(void) { (void)fprintf(stderr, - "usage: calendar [-ab] [-A num] [-B num] [-f calendarfile] " + "usage: calendar [-abw] [-A num] [-B num] [-f calendarfile] " "[-t [[[cc]yy]mm]dd]\n"); exit(1); } diff --git a/src/usr.bin/calendar/calendar.h b/src/usr.bin/calendar/calendar.h index b54d0b2..ac33b0d 100644 --- a/src/usr.bin/calendar/calendar.h +++ b/src/usr.bin/calendar/calendar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: calendar.h,v 1.14 2015/03/15 00:41:28 millert Exp $ */ +/* $OpenBSD: calendar.h,v 1.15 2015/12/07 18:46:35 espie Exp $ */ /* * Copyright (c) 1989, 1993, 1994 @@ -34,6 +34,7 @@ extern struct passwd *pw; extern int doall; +extern int daynames; extern int bodun_always; extern time_t f_time; extern struct tm *tp; @@ -46,9 +47,11 @@ struct fixs { int len; }; +#define PRINT_DATE_BASE_LEN 35 + struct event { time_t when; - char print_date[31]; + char print_date[PRINT_DATE_BASE_LEN+1]; char **desc; char *ldesc; struct event *next; @@ -56,7 +59,7 @@ struct event { struct match { time_t when; - char print_date[30]; + char print_date[PRINT_DATE_BASE_LEN]; int bodun; int var; struct match *next; diff --git a/src/usr.bin/calendar/calendars/calendar.all b/src/usr.bin/calendar/calendars/calendar.all index 172357d..9e759bf 100644 --- a/src/usr.bin/calendar/calendars/calendar.all +++ b/src/usr.bin/calendar/calendars/calendar.all @@ -1,7 +1,7 @@ /* * International and national calendar files * - * $OpenBSD: calendar.all,v 1.5 2013/03/15 08:37:10 jmc Exp $ + * $OpenBSD: calendar.all,v 1.7 2016/01/20 19:12:28 jmc Exp $ */ #ifndef _calendar_all_ @@ -17,5 +17,7 @@ #include <calendar.ushistory> #include <calendar.space> #include <calendar.canada> +#include <calendar.uk> +#include <calendar.nz> #endif /* !_calendar_all_ */ diff --git a/src/usr.bin/calendar/calendars/calendar.holiday b/src/usr.bin/calendar/calendars/calendar.holiday index ca9e5e0..4f87ead 100644 --- a/src/usr.bin/calendar/calendars/calendar.holiday +++ b/src/usr.bin/calendar/calendars/calendar.holiday @@ -1,7 +1,7 @@ /* * Holiday * - * $OpenBSD: calendar.holiday,v 1.32 2015/10/12 06:33:21 jmc Exp $ + * $OpenBSD: calendar.holiday,v 1.35 2016/01/20 19:12:28 jmc Exp $ */ #ifndef _calendar_holiday_ @@ -12,7 +12,6 @@ 01/01 Universal Fraternity Day in Mozambique 01/02 Ancestry Day in Haiti 01/02 St. Berchtold's Day in Switzerland -01/03 New Year's Holiday in Scotland 01/03 Revolution Day in Upper Volta 01/04 Independence Day in Burma 01/04 Martyrs Day in Zaire @@ -45,7 +44,6 @@ 02/02 Candlemas 02/04 Independence Commemoration Day in Sri Lanka 02/05 Constitution Day in Mexico -02/06 New Zealand Day 02/07 Independence Day in Grenada 02/08 Preseren Day (Cultural Holiday) in Slovenia 02/09 St. Maron's Day in Lebanon @@ -138,7 +136,7 @@ 04/22 Oklahoma Day in Oklahoma 04/24 Victory Day in Togo 04/24* Pesach - First Day of Passover - Festival of Freedom -04/25 Anzac Day in Australia, New Zealand, Tonga, Western Samoa +04/25* ANZAC Day in Australia, New Zealand, and various other influenced places 04/25 Liberation Day in Italy 04/25 National Flag Day in Swaziland 04/26 Confederate Memorial Day in Florida & Georgia @@ -285,7 +283,6 @@ 08/03 Independence Day in Jamaica, Niger 08/03 Memorial Day of Archbishop Makarios in Cyprus 08/04 Freedom Day in Guyana -08/05* Bank Holiday in Scotland and Northern Ireland 08/06 Bank Holiday in Australia, British Columbia, Fiji, Iceland, Ireland, Ontario 08/06 Emancipation Day in Bahamas @@ -393,7 +390,6 @@ 10/23 Chulalongkron's Day in Thailand 10/24 Independence Day in Zambia 10/24 United Nations Day -10/25 Labor Day in New Zealand 10/25 Taiwan Restoration Day in Taiwan 10/26 Agam Day in Nauru 10/26 Armed Forces Day in Benin, Rwanda @@ -435,7 +431,7 @@ 11/30 Independence Day in Barbados, People's Democratic Yemen Republic 11/30 National Day in Benin 11/30 National Heroes Day in Philippines -11/30 St. Andrew's Day +11/30 Saint Andrew's Day (also a bank holiday in Scotland) 12/01 Independence Day in Central African Republic 12/01 World AIDS Day 12/01 National Day in Romania @@ -490,7 +486,6 @@ 06/02 Corpus Christi in Paraguay 06/MonFirst Jefferson Davis's Birthday in Alabama & Mississippi (1st Monday) 06/MonFirst Jefferson Davis's Birthday in Florida, Georgia, & S. Carolina -06/04 Queen's Birthday in New Zealand 06/06 His Majesty, Yang Di-Pertuan Agong's Birthday in Malaysia 06/11 Queen's Birthday 06/12 Peace with Bolivia in Paraguay diff --git a/src/usr.bin/calendar/calendars/calendar.music b/src/usr.bin/calendar/calendars/calendar.music index 68bb1a7..d4bd30a 100644 --- a/src/usr.bin/calendar/calendars/calendar.music +++ b/src/usr.bin/calendar/calendars/calendar.music @@ -1,7 +1,7 @@ /* * Music * - * $OpenBSD: calendar.music,v 1.32 2015/05/21 10:42:30 jmc Exp $ + * $OpenBSD: calendar.music,v 1.33 2016/01/11 07:46:37 sthen Exp $ */ #ifndef _calendar_music_ @@ -23,6 +23,7 @@ 01/10 Jim Croce is born in Philadelphia, 1943 01/10 Pat Benatar is born in Long Island, 1952 01/10 Rod Stewart is born in Glasgow, Scotland, 1945 +01/11 David Bowie dies, 2016 01/11 Maurice Durufle is born in Louviers, France, 1902 01/11 Reinhold Gliere is born in Kiev, Russia, 1875 01/13 Eric Clapton plays the "Rainbow Concert" in London, 1973 diff --git a/src/usr.bin/calendar/calendars/calendar.nz b/src/usr.bin/calendar/calendars/calendar.nz new file mode 100644 index 0000000..619b980 --- /dev/null +++ b/src/usr.bin/calendar/calendars/calendar.nz @@ -0,0 +1,48 @@ +/* + * New Zealand holiday + * + * $OpenBSD: calendar.nz,v 1.1 2016/01/20 19:12:28 jmc Exp $ + */ + +#ifndef _calendar_nz_ +#define _calendar_nz_ + +01/01 New Year's Day +01/02 Day after New Year's Day (public holiday) +02/06* New Zealand/Waitangi Day (public holiday) +02/14 Saint Valentine's Day +04/01 April Fools' Day +04/SunFirst Daylight Saving Time ends; clocks move back (first Sunday of April) +05/SunSecond Mother's Day (2nd Sunday in May) +06/MonFirst Queen's Birthday (public holiday, ski season begins) +09/SunFirst Father's Day (1st Sunday of September) +09/26 Dominion Day +09/SunLast Daylight Saving Time starts; clocks move forward (last Sunday in September) +10/MonFourth Labour Day (public holiday) +10/31 Halloween +11/05 Guy Fawkes' Night +12/25 Christmas Day +12/26 Boxing Day +12/31 New Year's Eve + +/* Provincial anniversary days */ +01/22* Wellington Anniversary Day +01/29* Auckland and Northland Anniversary Days +02/01* Nelson Anniversary Day +03/23* Otago Anniversary Day +03/MonSecond New Plymouth Anniversary Day +Easter+2 Southland Anniversary Day +09/MonFourth South Canterbury Anniversary Day +09/FriThird Hawke's Bay Anniversary Day +11/01* Marlborough Anniversary Day +11/30* Chatham Islands Anniversary Day +12/01* Westland Anniversary Day +12/16* South Canterbury Anniversary Day + +/* Seasonal days */ +03/20* Autumnal Equinox +06/21* Winter Solstice +09/22* Vernal Equinox +12/21* Summer Solstice + +#endif /* !_calendar_nz_ */ diff --git a/src/usr.bin/calendar/day.c b/src/usr.bin/calendar/day.c index 0d73aae..cea9709 100644 --- a/src/usr.bin/calendar/day.c +++ b/src/usr.bin/calendar/day.c @@ -1,4 +1,4 @@ -/* $OpenBSD: day.c,v 1.30 2015/10/23 11:43:16 zhuk Exp $ */ +/* $OpenBSD: day.c,v 1.32 2015/12/08 19:04:50 mmcc Exp $ */ /* * Copyright (c) 1989, 1993, 1994 @@ -78,6 +78,14 @@ static struct fixs fnmonths[13]; /* full national months names */ static struct fixs nmonths[13]; /* short national month names */ void +fill_print_date(struct match *m, struct tm *tm) +{ + if (strftime(m->print_date, sizeof(m->print_date), + daynames ? "%a %b %d" : "%b %d", tm) == 0) + m->print_date[sizeof(m->print_date) - 1] = '\0'; +} + +void setnnames(void) { char buf[80]; @@ -90,8 +98,7 @@ setnnames(void) for (; l > 0 && isspace((unsigned char)buf[l - 1]); l--) ; buf[l] = '\0'; - if (ndays[i].name != NULL) - free(ndays[i].name); + free(ndays[i].name); if ((ndays[i].name = strdup(buf)) == NULL) err(1, NULL); ndays[i].len = strlen(buf); @@ -100,8 +107,7 @@ setnnames(void) for (; l > 0 && isspace((unsigned char)buf[l - 1]); l--) ; buf[l] = '\0'; - if (fndays[i].name != NULL) - free(fndays[i].name); + free(fndays[i].name); if ((fndays[i].name = strdup(buf)) == NULL) err(1, NULL); fndays[i].len = strlen(buf); @@ -113,8 +119,7 @@ setnnames(void) for (; l > 0 && isspace((unsigned char)buf[l - 1]); l--) ; buf[l] = '\0'; - if (nmonths[i].name != NULL) - free(nmonths[i].name); + free(nmonths[i].name); if ((nmonths[i].name = strdup(buf)) == NULL) err(1, NULL); nmonths[i].len = strlen(buf); @@ -123,8 +128,7 @@ setnnames(void) for (; l > 0 && isspace((unsigned char)buf[l - 1]); l--) ; buf[l] = '\0'; - if (fnmonths[i].name != NULL) - free(fnmonths[i].name); + free(fnmonths[i].name); if ((fnmonths[i].name = strdup(buf)) == NULL) err(1, NULL); fnmonths[i].len = strlen(buf); @@ -455,12 +459,7 @@ isnow(char *endp, int bodun) } (void)mktime(&tmtmp); - if (strftime(tmp->print_date, - sizeof(tmp->print_date), - /* "%a %b %d", &tm); Skip weekdays */ - "%b %d", &tmtmp) == 0) - tmp->print_date[sizeof(tmp->print_date) - 1] = '\0'; - + fill_print_date(tmp, &tmtmp); tmp->var = varp; tmp->next = NULL; return(tmp); @@ -549,11 +548,7 @@ isnow(char *endp, int bodun) if ((tmp = malloc(sizeof(struct match))) == NULL) err(1, NULL); tmp->when = ttmp; - if (strftime(tmp->print_date, - sizeof(tmp->print_date), - /* "%a %b %d", &tm); Skip weekdays */ - "%b %d", &tmtmp) == 0) - tmp->print_date[sizeof(tmp->print_date) - 1] = '\0'; + fill_print_date(tmp, &tmtmp); tmp->bodun = bodun && tdiff == -1; tmp->var = varp; tmp->next = NULL; diff --git a/src/usr.bin/calendar/io.c b/src/usr.bin/calendar/io.c index 05fe7ae..f17cacb 100644 --- a/src/usr.bin/calendar/io.c +++ b/src/usr.bin/calendar/io.c @@ -1,4 +1,4 @@ -/* $OpenBSD: io.c,v 1.42 2015/10/23 12:36:23 deraadt Exp $ */ +/* $OpenBSD: io.c,v 1.43 2015/12/08 19:04:50 mmcc Exp $ */ /* * Copyright (c) 1989, 1993, 1994 @@ -98,8 +98,7 @@ cal(void) !strcmp(buf + 5, "by_BY.KOI8-B")) { bodun_maybe++; bodun = 0; - if (prefix) - free(prefix); + free(prefix); prefix = NULL; } else bodun_maybe = 0; @@ -124,8 +123,7 @@ cal(void) calendar = LUNAR; } else if (bodun_maybe && strncmp(buf, "BODUN=", 6) == 0) { bodun++; - if (prefix) - free(prefix); + free(prefix); if ((prefix = strdup(buf + 6)) == NULL) err(1, NULL); continue; @@ -138,8 +136,7 @@ cal(void) (p - buf == spev[i].nlen) && buf[spev[i].nlen + 1]) { p++; - if (spev[i].uname != NULL) - free(spev[i].uname); + free(spev[i].uname); if ((spev[i].uname = strdup(p)) == NULL) err(1, NULL); spev[i].ulen = strlen(p); @@ -211,8 +208,7 @@ cal(void) tmp = events; while (tmp) { events = tmp; - if (tmp->ldesc) - free(tmp->ldesc); + free(tmp->ldesc); tmp = tmp->next; free(events); } diff --git a/src/usr.bin/jot/Makefile b/src/usr.bin/jot/Makefile index c552df3..3498301 100644 --- a/src/usr.bin/jot/Makefile +++ b/src/usr.bin/jot/Makefile @@ -1,6 +1,8 @@ -# $OpenBSD: Makefile,v 1.4 2003/12/29 08:51:19 otto Exp $ +# $OpenBSD: Makefile,v 1.5 2016/01/10 01:15:52 tb Exp $ PROG= jot CFLAGS+= -Wall +LDADD+= -lm +DPADD+= ${LIBM} .include <bsd.prog.mk> diff --git a/src/usr.bin/jot/jot.1 b/src/usr.bin/jot/jot.1 index 9845fa3..7bd0675 100644 --- a/src/usr.bin/jot/jot.1 +++ b/src/usr.bin/jot/jot.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: jot.1,v 1.18 2014/01/20 05:07:48 schwarze Exp $ +.\" $OpenBSD: jot.1,v 1.19 2016/01/04 23:21:28 schwarze Exp $ .\" $NetBSD: jot.1,v 1.2 1994/11/14 20:27:36 jtc Exp $ .\" .\" Copyright (c) 1993 @@ -30,7 +30,7 @@ .\" .\" @(#)jot.1 8.1 (Berkeley) 6/6/93 .\" -.Dd $Mdocdate: January 20 2014 $ +.Dd $Mdocdate: January 4 2016 $ .Dt JOT 1 .Os .Sh NAME @@ -313,3 +313,10 @@ To print all lines 80 characters or longer: .Xr yes 1 , .Xr arc4random 3 , .Xr printf 3 +.Sh HISTORY +The +.Nm +utility first appeared in +.Bx 4.2 . +.Sh AUTHORS +.An John A. Kunze diff --git a/src/usr.bin/jot/jot.c b/src/usr.bin/jot/jot.c index 8952ead..e4fdade 100644 --- a/src/usr.bin/jot/jot.c +++ b/src/usr.bin/jot/jot.c @@ -1,4 +1,4 @@ -/* $OpenBSD: jot.c,v 1.26 2015/10/09 01:37:07 deraadt Exp $ */ +/* $OpenBSD: jot.c,v 1.27 2016/01/10 01:15:52 tb Exp $ */ /* $NetBSD: jot.c,v 1.3 1994/12/02 20:29:43 pk Exp $ */ /*- @@ -40,6 +40,8 @@ #include <stdbool.h> #include <ctype.h> #include <limits.h> +#include <math.h> +#include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -268,11 +270,45 @@ main(int argc, char *argv[]) if (reps == 0) infinity = true; if (randomize) { - x = (ender - begin) * (ender > begin ? 1 : -1); + bool use_unif; + uint32_t pow10 = 1; + uint32_t uintx = 0; /* Initialized to make gcc happy. */ + + if (prec > 9) /* pow(10, prec) > UINT32_MAX */ + errx(1, "requested precision too large"); + + while (prec-- > 0) + pow10 *= 10; + + if (ender < begin) { + x = begin; + begin = ender; + ender = x; + } + x = ender - begin; + + /* + * If pow10 * (ender - begin) is an integer, use + * arc4random_uniform(). + */ + use_unif = fmod(pow10 * (ender - begin), 1) == 0; + if (use_unif) { + uintx = pow10 * (ender - begin); + if (uintx >= UINT32_MAX) + errx(1, "requested range too large"); + uintx++; + } + for (i = 1; i <= reps || infinity; i++) { double v; - y = arc4random() / ((double)0xffffffff + 1); - v = y * x + begin; + + if (use_unif) { + y = arc4random_uniform(uintx) / (double)pow10; + v = y + begin; + } else { + y = arc4random() / ((double)0xffffffff + 1); + v = y * x + begin; + } if (putdata(v, reps == i && !infinity)) errx(1, "range error in conversion: %f", v); } diff --git a/src/usr.bin/lam/lam.1 b/src/usr.bin/lam/lam.1 index 80a7846..fd9d5d0 100644 --- a/src/usr.bin/lam/lam.1 +++ b/src/usr.bin/lam/lam.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: lam.1,v 1.8 2009/08/16 09:41:08 sobrado Exp $ +.\" $OpenBSD: lam.1,v 1.9 2016/01/04 23:21:28 schwarze Exp $ .\" $NetBSD: lam.1,v 1.4 2002/02/08 01:36:25 ross Exp $ .\" .\" Copyright (c) 1993 @@ -30,7 +30,7 @@ .\" .\" @(#)lam.1 8.1 (Berkeley) 6/6/93 .\" -.Dd $Mdocdate: August 16 2009 $ +.Dd $Mdocdate: January 4 2016 $ .Dt LAM 1 .Os .Sh NAME @@ -122,3 +122,10 @@ can be done with: .Xr join 1 , .Xr pr 1 , .Xr printf 1 +.Sh HISTORY +The +.Nm +utility first appeared in +.Bx 4.2 . +.Sh AUTHORS +.An John A. Kunze diff --git a/src/usr.bin/rs/Makefile b/src/usr.bin/rs/Makefile index 6c658e8..7fb1d6b 100644 --- a/src/usr.bin/rs/Makefile +++ b/src/usr.bin/rs/Makefile @@ -1,6 +1,6 @@ -# $OpenBSD: Makefile,v 1.2 1996/06/26 05:38:46 deraadt Exp $ - +# $OpenBSD: Makefile,v 1.3 2015/12/03 12:23:15 schwarze Exp $ PROG= rs +SRCS= rs.c utf8.c .include <bsd.prog.mk> diff --git a/src/usr.bin/rs/rs.1 b/src/usr.bin/rs/rs.1 index 85d05aa..d5afec4 100644 --- a/src/usr.bin/rs/rs.1 +++ b/src/usr.bin/rs/rs.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: rs.1,v 1.16 2014/01/20 05:07:48 schwarze Exp $ +.\" $OpenBSD: rs.1,v 1.18 2016/01/04 23:21:28 schwarze Exp $ .\" $FreeBSD: src/usr.bin/rs/rs.1,v 1.4 1999/08/28 01:05:21 peter Exp $ .\" .\" Copyright (c) 1993 @@ -30,7 +30,7 @@ .\" .\" @(#)rs.1 8.2 (Berkeley) 12/30/93 .\" -.Dd $Mdocdate: January 20 2014 $ +.Dd $Mdocdate: January 4 2016 $ .Dt RS 1 .Os .Sh NAME @@ -167,6 +167,19 @@ transposes its input, and assumes one array entry per input line unless the first non-ignored line is longer than the display width. Option letters which take numerical arguments interpret a missing number as zero unless otherwise indicated. +.Sh ENVIRONMENT +.Bl -tag -width LC_CTYPE +.It Ev LC_CTYPE +The character set +.Xr locale 1 . +It is used to calculate required column widths and to adjust entries +within columns. +If unset or set to +.Qq C , +.Qq POSIX , +or an unsupported value, each byte is treated as a character of +display width 1. +.El .Sh EXAMPLES .Nm can be used as a filter to convert the stream output @@ -221,6 +234,13 @@ $ rs \-eC 0 4 | sort | rs \-c 0 1 .Xr pr 1 , .Xr sort 1 , .Xr vi 1 +.Sh HISTORY +The +.Nm +utility first appeared in +.Bx 4.2 . +.Sh AUTHORS +.An John A. Kunze .Sh BUGS Handles only two dimensional arrays. .Pp diff --git a/src/usr.bin/rs/rs.c b/src/usr.bin/rs/rs.c index 5d702cf..bb149ff 100644 --- a/src/usr.bin/rs/rs.c +++ b/src/usr.bin/rs/rs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rs.c,v 1.28 2015/11/10 14:42:41 schwarze Exp $ */ +/* $OpenBSD: rs.c,v 1.30 2015/12/03 12:23:15 schwarze Exp $ */ /*- * Copyright (c) 1993 @@ -39,11 +39,17 @@ #include <err.h> #include <errno.h> #include <limits.h> +#include <locale.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> +struct entry { + int w; /* Display width. */ + char *s; /* Multibyte string. */ +}; + long flags; #define TRANSPOSE 000001 #define MTRANSPOSE 000002 @@ -63,26 +69,27 @@ long flags; short *colwidths; int nelem; -char **elem; -char **endelem; +struct entry *elem; +struct entry *endelem; char *curline; int allocsize = BUFSIZ; -ssize_t curlen; int irows, icols; int orows, ocols; -ssize_t maxlen; +int maxwidth; int skip; int propgutter; char isep = ' ', osep = ' '; int owidth = 80, gutter = 2; +int mbsavis(char **, const char *); + void usage(void); void getargs(int, char *[]); void getfile(void); int get_line(void); -char **getptrs(char **); +struct entry *getptrs(struct entry *); void prepfile(void); -void prints(char *, int); +void prints(struct entry *, int); void putfile(void); #define INCR(ep) do { \ @@ -93,6 +100,8 @@ void putfile(void); int main(int argc, char *argv[]) { + setlocale(LC_CTYPE, ""); + if (pledge("stdio", NULL) == -1) err(1, "pledge"); @@ -110,13 +119,14 @@ main(int argc, char *argv[]) void getfile(void) { + const char delim[2] = { isep, '\0' }; char *p; - char *endp; - char **ep = NULL; + struct entry *ep; int multisep = (flags & ONEISEPONLY ? 0 : 1); int nullpad = flags & NULLPAD; - char **padto; + struct entry *padto; + curline = NULL; while (skip--) { if (get_line() == EOF) return; @@ -125,67 +135,67 @@ getfile(void) } if (get_line() == EOF) return; - if (flags & NOARGS && curlen < owidth) + if (flags & NOARGS && strlen(curline) < (size_t)owidth) flags |= ONEPERLINE; if (flags & ONEPERLINE) icols = 1; else /* count cols on first line */ - for (p = curline, endp = curline + curlen; p < endp; p++) { + for (p = curline; *p != '\0'; p++) { if (*p == isep && multisep) continue; icols++; while (*p && *p != isep) p++; } - ep = getptrs(elem); + ep = getptrs(NULL); p = curline; do { if (flags & ONEPERLINE) { - *ep = curline; + ep->w = mbsavis(&ep->s, curline); + if (maxwidth < ep->w) + maxwidth = ep->w; INCR(ep); /* prepare for next entry */ - if (maxlen < curlen) - maxlen = curlen; irows++; continue; } - for (p = curline, endp = curline + curlen; p < endp; p++) { - if (*p == isep && multisep) - continue; /* eat up column separators */ - if (*p == isep) /* must be an empty column */ - *ep = ""; - else /* store column entry */ - *ep = p; - while (p < endp && *p != isep) - p++; /* find end of entry */ - *p = '\0'; /* mark end of entry */ - if (maxlen < p - *ep) /* update maxlen */ - maxlen = p - *ep; + p = curline; + while (p != NULL && *p != '\0') { + if (*p == isep) { + p++; + if (multisep) + continue; + ep->s = ""; /* empty column */ + ep->w = 0; + } else + ep->w = mbsavis(&ep->s, strsep(&p, delim)); + if (maxwidth < ep->w) + maxwidth = ep->w; INCR(ep); /* prepare for next entry */ } irows++; /* update row count */ if (nullpad) { /* pad missing entries */ padto = elem + irows * icols; while (ep < padto) { - *ep = ""; + ep->s = ""; + ep->w = 0; INCR(ep); } } } while (get_line() != EOF); - *ep = NULL; /* mark end of pointers */ nelem = ep - elem; } void putfile(void) { - char **ep; + struct entry *ep; int i, j, n; ep = elem; if (flags & TRANSPOSE) { for (i = 0; i < orows; i++) { for (j = i; j < nelem; j += orows) - prints(ep[j], (j - i) / orows); + prints(ep + j, (j - i) / orows); putchar('\n'); } } else { @@ -193,7 +203,7 @@ putfile(void) for (j = 0; j < ocols; j++) { if (n++ >= nelem) break; - prints(*ep++, j); + prints(ep++, j); } putchar('\n'); } @@ -201,19 +211,15 @@ putfile(void) } void -prints(char *s, int col) +prints(struct entry *ep, int col) { int n; - char *p = s; - while (*p) - p++; - n = (flags & ONEOSEPONLY ? 1 : colwidths[col] - (p - s)); + n = (flags & ONEOSEPONLY ? 1 : colwidths[col] - ep->w); if (flags & RIGHTADJUST) while (n-- > 0) putchar(osep); - for (p = s; *p; p++) - putchar(*p); + fputs(ep->s, stdout); while (n-- > 0) putchar(osep); } @@ -232,18 +238,18 @@ usage(void) void prepfile(void) { - char **ep; + struct entry *ep; int i; int j; - char **lp; + struct entry *lp; int colw; int max = 0; int n; if (!nelem) exit(0); - gutter += maxlen * propgutter / 100.0; - colw = maxlen + gutter; + gutter += maxwidth * propgutter / 100.0; + colw = maxwidth + gutter; if (flags & MTRANSPOSE) { orows = icols; ocols = irows; @@ -263,33 +269,29 @@ prepfile(void) orows = nelem / ocols + (nelem % ocols ? 1 : 0); else if (ocols == 0) /* decide on cols */ ocols = nelem / orows + (nelem % orows ? 1 : 0); - lp = elem + orows * ocols; - while (lp > endelem) { - getptrs(elem + nelem); - lp = elem + orows * ocols; - } + while ((lp = elem + orows * ocols) > endelem) + (void)getptrs(NULL); if (flags & RECYCLE) { for (ep = elem + nelem; ep < lp; ep++) - *ep = *(ep - nelem); + memcpy(ep, ep - nelem, sizeof(*ep)); nelem = lp - elem; } if (!(colwidths = calloc(ocols, sizeof(short)))) errx(1, "malloc: No gutter space"); if (flags & SQUEEZE) { - if (flags & TRANSPOSE) - for (ep = elem, i = 0; i < ocols; i++) { - for (j = 0; j < orows; j++) - if ((n = strlen(*ep++)) > max) - max = n; - colwidths[i] = max + gutter; - } - else - for (ep = elem, i = 0; i < ocols; i++) { + for (ep = elem, i = 0; i < ocols; i++) { + max = 0; + if (flags & TRANSPOSE) { + for (j = 0; j < orows; j++, ep++) + if (ep->w > max) + max = ep->w; + } else { for (j = i; j < nelem; j += ocols) - if ((n = strlen(ep[j])) > max) - max = n; - colwidths[i] = max + gutter; + if (ep[j].w > max) + max = ep[j].w; } + colwidths[i] = max + gutter; + } } else { for (i = 0; i < ocols; i++) colwidths[i] = colw; @@ -306,43 +308,38 @@ prepfile(void) } int -get_line(void) /* get line; maintain curline, curlen; manage storage */ +get_line(void) { - static char *ibuf = NULL; - static size_t ibufsz = 0; + static size_t cursz; + static ssize_t curlen; if (irows > 0 && flags & DETAILSHAPE) printf(" %zd line %d\n", curlen, irows); - if ((curlen = getline(&ibuf, &ibufsz, stdin)) == EOF) { + if ((curlen = getline(&curline, &cursz, stdin)) == EOF) { if (ferror(stdin)) err(1, NULL); return EOF; } - if (curlen > 0 && ibuf[curlen - 1] == '\n') - ibuf[--curlen] = '\0'; - - if (skip >= 0 || flags & SHAPEONLY) - curline = ibuf; - else if ((curline = strdup(ibuf)) == NULL) - err(1, NULL); + if (curlen > 0 && curline[curlen - 1] == '\n') + curline[--curlen] = '\0'; return 0; } -char ** -getptrs(char **sp) +struct entry * +getptrs(struct entry *sp) { - char **p; + struct entry *p; int newsize; newsize = allocsize * 2; - p = reallocarray(elem, newsize, sizeof(char *)); + p = reallocarray(elem, newsize, sizeof(*p)); if (p == NULL) err(1, "no memory"); allocsize = newsize; - sp += p - elem; + sp = sp == NULL ? p : p + (sp - elem); elem = p; endelem = elem + allocsize; return(sp); diff --git a/src/usr.bin/signify/signify.1 b/src/usr.bin/signify/signify.1 index 12fd9be..dbf2ea5 100644 --- a/src/usr.bin/signify/signify.1 +++ b/src/usr.bin/signify/signify.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: signify.1,v 1.31 2015/07/14 23:30:02 florian Exp $ +.\" $OpenBSD: signify.1,v 1.33 2016/01/06 23:14:05 benno Exp $ .\" .\"Copyright (c) 2013 Marc Espie <espie@openbsd.org> .\"Copyright (c) 2013 Ted Unangst <tedu@openbsd.org> @@ -14,7 +14,7 @@ .\"WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN .\"ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\"OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -.Dd $Mdocdate: July 14 2015 $ +.Dd $Mdocdate: January 6 2016 $ .Dt SIGNIFY 1 .Os .Sh NAME @@ -148,12 +148,12 @@ Verify a release directory containing .Pa SHA256.sig and a full set of release files: .Bd -literal -offset indent -compact -$ signify -C -p /etc/signify/openbsd-58-base.pub -x SHA256.sig +$ signify -C -p /etc/signify/openbsd-60-base.pub -x SHA256.sig .Ed .Pp Verify a bsd.rd before an upgrade: .Bd -literal -offset indent -compact -$ signify -C -p /etc/signify/openbsd-58-base.pub -x SHA256.sig bsd.rd +$ signify -C -p /etc/signify/openbsd-60-base.pub -x SHA256.sig bsd.rd .Ed .Sh SEE ALSO .Xr fw_update 1 , diff --git a/src/usr.bin/signify/signify.c b/src/usr.bin/signify/signify.c index 3bc4c6c..a4cb84a 100644 --- a/src/usr.bin/signify/signify.c +++ b/src/usr.bin/signify/signify.c @@ -1,4 +1,4 @@ -/* $OpenBSD: signify.c,v 1.104 2015/11/02 22:01:10 bluhm Exp $ */ +/* $OpenBSD: signify.c,v 1.105 2015/12/04 11:05:22 tedu Exp $ */ /* * Copyright (c) 2013 Ted Unangst <tedu@openbsd.org> * @@ -367,7 +367,7 @@ sign(const char *seckeyfile, const char *msgfile, const char *sigfile, SHA512Update(&ctx, enckey.seckey, sizeof(enckey.seckey)); SHA512Final(digest, &ctx); if (memcmp(enckey.checksum, digest, sizeof(enckey.checksum)) != 0) - errx(1, "incorrect passphrase"); + errx(1, "incorrect passphrase"); explicit_bzero(digest, sizeof(digest)); msg = readmsg(msgfile, &msglen); @@ -559,9 +559,8 @@ verifychecksum(struct checksum *c, int quiet) } else { errx(1, "can't handle algorithm %s", c->algo); } - if (strcmp(c->hash, buf) != 0) { + if (strcmp(c->hash, buf) != 0) return 0; - } if (!quiet) printf("%s: OK\n", c->file); return 1; |