- Update to 1.1

PR:		217569
Submitted by:	ben.lavery@hashbang0.com(maintainer)
This commit is contained in:
Wen Heping 2017-03-06 07:05:10 +00:00
parent 50f44d5b23
commit 654f8cc28d
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=435518
7 changed files with 56 additions and 44 deletions

View File

@ -2,25 +2,29 @@
# $FreeBSD$
PORTNAME= bunnysay
PORTVERSION= 1.0
PORTVERSION= 1.1
DISTVERSIONPREFIX= v
CATEGORIES= games
MAINTAINER= ben.lavery@hashbang0.com
COMMENT= Bunny Sign for terminals
COMMENT= Bunny Sign for terminals with UTF-8 support
LICENSE= GPLv3+
LICENSE_FILE= ${WRKSRC}/LICENSE
USES= cmake compiler:c++11-lang dos2unix
DOS2UNIX_FILES= src/BunnySay.cpp src/BunnySay.h
USES= gmake
ALL_TARGET= bunnysay
USE_GITHUB= yes
GH_ACCOUNT= co60ca
PLIST_FILES= bin/bunnysay
post-extract:
@${MV} ${WRKSRC}/makefile ${WRKSRC}/Makefile
do-install:
${INSTALL_PROGRAM} ${WRKSRC}/${PORTNAME} ${STAGEDIR}${PREFIX}/bin/${PORTNAME}
${INSTALL_PROGRAM} ${WRKSRC}/bunnysay ${STAGEDIR}${PREFIX}/bin/${PORTNAME}
.include <bsd.port.mk>

View File

@ -1,3 +1,3 @@
TIMESTAMP = 1473266065
SHA256 (co60ca-bunnysay-v1.0_GH0.tar.gz) = 81fe0b57fb307d6e6ae8ab660f0f7720a16f83b271c477812af84a3c23081e77
SIZE (co60ca-bunnysay-v1.0_GH0.tar.gz) = 14703
TIMESTAMP = 1488747822
SHA256 (co60ca-bunnysay-v1.1_GH0.tar.gz) = 556752ff31633c54b2a6984dbab21bd2a79a94022277c0c2dc2f1590c8f2dbfe
SIZE (co60ca-bunnysay-v1.1_GH0.tar.gz) = 17307

View File

@ -1,25 +0,0 @@
--- src/BunnySay.cpp.orig 2016-08-31 12:47:32 UTC
+++ src/BunnySay.cpp
@@ -34,8 +34,9 @@ L"/  ";
// Writes wstring input to the stdout after chunking it and converting
// all characters to their wide counterparts in unicode
void BunnySay::writeBunnySay(std::wstring input) {
+ std::wstring_convert<std::codecvt_utf8<wchar_t>,wchar_t> convert;
input = replaceString(input);
- std::wcout << bunny;
+ std::cout << convert.to_bytes(bunny);
bool left = true;
std::vector<std::wstring> vs;
vs = splitAtWidth(input + L" ", width);
@@ -54,9 +55,9 @@ void BunnySay::writeBunnySay(std::wstrin
// Add the pipes
curstring = L"" + curstring + L"\n";
- std::wcout << curstring;
+ std::cout << convert.to_bytes(curstring);
}
- std::wcout << bunny2 << std::endl;
+ std::cout << convert.to_bytes(bunny2) << std::endl;
}
// Helper function to split a sentance delimited with fixed-width spaces
// into strings 10 chars or less

View File

@ -1,10 +0,0 @@
--- src/BunnySay.h.orig 2016-08-31 12:47:32 UTC
+++ src/BunnySay.h
@@ -30,6 +30,7 @@
#include <stack>
#include <vector>
#include <sstream>
+#include <codecvt>
namespace bunnysay {
class BunnySay {

View File

@ -0,0 +1,19 @@
--- src/bunnysay.cc.orig 2017-02-28 03:26:39 UTC
+++ src/bunnysay.cc
@@ -99,7 +99,7 @@ void fullWidth(std::vector<std::vector<R
}
void padTo(std::vector<std::vector<Rune>> *input, size_t width) {
- bool left = false;
+ bool left = true;
for (auto &rv: *input) {
while(rv.size() < width) {
if (left) {
@@ -109,6 +109,7 @@ void padTo(std::vector<std::vector<Rune>
}
left = !left;
}
+ left = true;
}
}

View File

@ -0,0 +1,24 @@
--- src/runbunnysay.cc.orig 2017-02-28 03:26:39 UTC
+++ src/runbunnysay.cc
@@ -20,7 +20,6 @@
*/
#include "bunnysay.h"
#include <iostream>
-#include <iterator>
#include <string>
void usage(char *prog) {
@@ -33,9 +32,10 @@ void usage(char *prog) {
int main(int argc, char **argv) {
std::string buff;
if (argc >= 2 && std::string(argv[1]) == "--") {
- std::istream_iterator<char> it(std::cin);
- std::istream_iterator<char> end;
- buff = std::string(it, end);
+ std::string line;
+ while (std::getline(std::cin, line)) {
+ buff += std::string(line);
+ }
} else if (argc >= 2) {
for (int i = 1; i < argc; i++) {
if (i != 1) {

View File

@ -1,3 +1,3 @@
Bunny Sign for terminals with wchar support.
Bunny Sign for terminals with UTF-8 support
WWW: https://github.com/co60ca/bunnysay