dist: clean
mkdir -p release/src ${NAME}-${VERSION}
cp -R LICENSE.txt Makefile README.md CHANGELOG.md \
- ${NAME}-completion.zsh ${NAME}.1 main.c src ${NAME}-${VERSION}
+ ${NAME}-completion.zsh man main.c src ${NAME}-${VERSION}
tar zcfv release/src/${NAME}-${VERSION}.tar.gz ${NAME}-${VERSION}
rm -rf ${NAME}-${VERSION}
cp -f ${NAME} ${DESTDIR}${PREFIX}/bin
chmod 755 ${DESTDIR}${PREFIX}/bin/${NAME}
mkdir -p ${DESTDIR}${MANPREFIX}/man1
- sed "s/VERSION/${VERSION}/g" < ${NAME}.1 > ${DESTDIR}${MANPREFIX}/man1/${NAME}.1
- chmod 644 ${DESTDIR}${MANPREFIX}/man1/${NAME}.1
+ sed "s/VERSION/${VERSION}/g" < man/${NAME}-en.1 > \
+ ${DESTDIR}${MANPREFIX}/man1/${NAME}-en.1
+ sed "s/VERSION/${VERSION}/g" < man/${NAME}-jp.1 > \
+ ${DESTDIR}${MANPREFIX}/man1/${NAME}-jp.1
+ chmod 644 ${DESTDIR}${MANPREFIX}/man1/${NAME}-en.1
+ chmod 644 ${DESTDIR}${MANPREFIX}/man1/${NAME}-jp.1
install-zsh:
cp sp-completion.zsh ${DESTDIR}${PREFIX}/share/zsh/site-functions/_sp
# sp
シンプルなパスワードマネージャー
+Simple Password Manager
-## インストールする方法
+## インストールする方法 | Installation
### CRUX
```sh
-doas prt-get depinst gpgme gnupg pinentry
-doas make install
-doas make install-zsh
-```
-
-又は
-
-```sh
-doas su
-cd /etc/ports
-wget https://076.moe/repo/crux/suwaports.httpup
-echo "prtdir /usr/ports/suwaports" >> /etc/prt-get.conf
-ports -u
-prt-get depinst sp
+doas prt-get depinst gpgme gnupg pinentry bmake
+bmake
+doas bmake install PREFIX=/usr
+doas bmake install-zsh PREFIX=/usr
```
### Artix
```sh
-doas pacman -S base-devel gpgme gnupg pinentry
-doas make install
-doas make install-zsh
+doas pacman -S base-devel gpgme gnupg pinentry bmake
+bmake
+doas bmake install PREFIX=/usr
+doas bmake install-zsh PREFIX=/usr
```
### OpenBSD
```sh
-doas pkg_add gmake gpgme gnupg pinentry
-doas gmake install PREFIX=/usr/local
-doas gmake install-zsh PREFIX=/usr/local
+doas pkg_add gpgme gnupg pinentry
+make
+doas make install
+doas make install-zsh
```
### FreeBSD
```sh
-doas pkg install gmake gpgme gnupg pinentry
-doas gmake install PREFIX=/usr/local
-doas gmake install-zsh PREFIX=/usr/local
+doas pkg install gpgme gnupg pinentry
+make
+doas make install
+doas make install-zsh
```
-## 初期設定
+## 初期設定 | Initial setup
「gpg -k」でGPG鍵IDを確認して、「sp -i [GPG ID]」を実行して下さい。
+Confirm your GPG key ID with "gpg -k", and run "sp -i [GPG ID]".
-## 使い方
-### パスワードの作成
-#### 強いパスワードの場合
+## 使い方 | Usage
+### パスワードの作成 | Password generation
+#### 強いパスワードの場合 | Strong password
```sh
$ sp -g 64
nSYGSF2lWGCUsqKCRB_~mZm+spaU<zvtt%um'01$tj4h,^nB6JqX#Cm$!U+s;c7:
```
又は
+Or
```sh
$ sp -g 64 secure
nSYGSF2lWGCUsqKCRB_~mZm+spaU<zvtt%um'01$tj4h,^nB6JqX#Cm$!U+s;c7:
```
-#### 弱いパスワードの場合
+#### 弱いパスワードの場合 | Weak password
```sh
$ sp -g 12 risk
2aKBwb858mzg
```
-### パスワードの追加
+### パスワードの追加 | Add password
「suwako」というユーザー名の場合:
+If the username is "suwake":
```sh
$ sp -a 076.moe/suwako
パスワード:
```
入力中は何も表示されないので、ご注意下さい。
-### パスワードの表示
+### 英語で表示する場合 | For English
+```sh
+$ SP_LANG=en sp -a 076.moe/suwako
+Password:
+Password (for verification):
+The password got saved.
+```
+
+### パスワードの表示 | Show password
```sh
$ sp -s 076.moe/suwako
nSYGSF2lWGCUsqKCRB_~mZm+spaU<zvtt%um'01$tj4h,^nB6JqX#Cm$!U+s;c7:
```
表示せずコピーする場合は、「sp -y 076.moe/suwako」を使用して下さい。
+If you want to copy the password to the clipboard without showing it,
+use "sp -y 076.moe/suwako" instead.
-### パスワードの削除
+### パスワードの削除 | Delete password
```sh
$ sp -d 076.moe/suwako
パスワード「076.moe/suwako」を本当に削除する事が宜しいでしょうか? (y/N): y
パスワードを削除しました。
```
-## TOTP(ワンタイムパスワード)
-### QRコードから
+### パスワードの編集 | Edit password
+```sh
+$ sp -e 076.moe/suwako
+パスワード:
+パスワード(確認用):
+パスワードを保存出来ました。
+```
+
+## TOTP(ワンタイムパスワード) | TOTP (one time password)
+### QRコードから | From QR code
QRコードをダウンロードし、zbarimgを使用して「QR-Code:」以降の部分をコピーし、
spに追加して下さい。\
`sp -a`を実行すると、「パスワード」を聞かれますが、
TOTPの場合は「otpauth://」から始まる文字列をコピペして下さい。
+
+Download the QR code image, copy everything after "QR-Code:"
+you get after using zbarimg, and add into sp.
+If you run "sp -a", it'll ask for a "password", but in the case of TOTP,
+paste everything starting from "otpauth://".
```sh
$ zbarimg -q gitler.png
QR-Code:otpauth://totp/Gitler%20%28gitler.moe%29:suwako?algorithm=SHA1&digits=6&issuer=Gitler%20%28gitler.moe%29&period=30&secret=〇〇
パスワード(確認用):
パスワードを保存出来ました。
-$ sp -q gitler-otp
+$ sp -o gitler-otp
123456
```
--- /dev/null
+.TH SP 1 VERSION
+.SH NAME
+sp - Simple Password Manager
+.br
+.B sp
+[-i] [-i \fI\,gpg-id\fR] [-adeosy \fI\,password\fR] [-g \fI\,length\fR [\fI\,secure\fR|\fI\,risk\fR]]
+.SH DESCRIPTION
+.PP
+Simple Password Manager
+.TP
+\fB\,a\fR \fI\,password\fR
+Add password
+.TP
+\fB\,d\fR \fI\,password\fR
+Delete password
+.TP
+\fB\,e\fR \fI\,password\fR
+Edit password
+.TP
+\fB\,g\fR \fI,length\fR \fI,risk|secure\fR
+Generate a random password using the preferred amount of digits.
+.br
+The default is 64 characters.
+.br
+secure = Lower and uppercase + digits + special characters (default)
+.br
+risk = only lowercase and uppercase + digits
+.TP
+\fB\,i\fR \fI\,gpg-id\fR
+Initialize password storage using GPG
+.TP
+\fB\,l\fR
+Show a list of passwords
+.TP
+\fB\,o\fR \fI\,password\fR
+ワンタイムパスワード(TOTP)を表示
+Show one time password (TOTP)
+.TP
+\fB\,s\fR \fI\,password\fR
+Show password
+.TP
+\fB\,v\fR
+Show version
+.TP
+\fB\,y\fR \fI\,password\fR
+Copy password to the clipboard without showing the password (Xorg-only)
+.SH LANGUAGE
+The default language is Japanese. In order to use English,
+.br
+please add "SP_LANG=en" to the `.zshrc` or `.bashrc` file.
+.SH EXAMPLES
+\&...
+
+$ sp -i 12345678901234567890ABCDEFABCDEF1234ABCD
+.br
+初期設定に完了しました。
+
+$ cat ~/.local/share/sp/.gpg-id
+.br
+12345678901234567890ABCDEFABCDEF1234ABCD
+.ED
+
+\&...
+
+$ sp -a 076.moe/nitori
+.br
+Password:
+.br
+Password (for verification):
+.br
+The password got saved.
+
+$ sp -s 076.moe/nitori
+.br
+kyuuri
+
+$ sp -d 076.moe/nitori
+.br
+Are you sure you want to delete the password '076.moe/nitori' (y/N): y
+.br
+The password got deleted
+.br
+
+$ sp -s 076.moe/nitori
+.br
+Failed to open file: No such file or directory
+.ED
+
+\&...
+
+$ sp -a 076.moe/nitori
+.br
+Password:
+.br
+Password (for verification):
+.br
+The password got saved.
+
+$ sp -s 076.moe/nitori
+.br
+kyuuri
+
+$ sp -a 076.moe/nitori
+.br
+パスワードが既に存在しています。
+.br
+変更するには、「 sp -e 076.moe/nitori 」を実行して下さい。
+
+$ SP_LANG=en sp -a 076.moe/nitori
+.br
+Password already exist.
+.br
+For edit, please run ' sp -e 076.moe/nitori '.
+
+$ sp -e 076.moe/nitori
+.br
+Password:
+.br
+Password (for verification):
+.br
+The password got saved.
+
+$ sp -s 076.moe/nitori
+.br
+kappa
+.ED
+
+\&...
+
+$ sp -g
+.br
+\5C'F6=8r&:OO=P?{Ry-3d4%z#7Hki}965l`j2xJSRoHQkvj^nz+YPx4g74yu_OT
+
+$ sp -g 12
+.br
+{%#upiPiayqZ
+
+$ sp -g 12 risk
+.br
+iwxoumJC9wZH
+.ED
+
+\&...
+
+$ doas pkg_add zbar
+.br
+quirks-7.14 signed on 2024-05-21T22:52:07Z
+.br
+zbar-0.23.90p2: ok
+
+$ zbarimg -q --raw Untitled.png
+.br
+otpauth://totp/GitHub:TechnicalSuwako?secret=ABCDEFGHIJKLMNOP&issuer=GitHub
+
+$ sp -a github.com/2fa
+.br
+Password:
+.br
+Password (for verification):
+.br
+The password got saved.
+
+$ sp -s github.com/2fa
+.br
+otpauth://totp/GitHub:TechnicalSuwako?secret=ABCDEFGHIJKLMNOP&issuer=GitHub
+
+$ sp -o github.com/2fa
+.br
+123456
+.Ed
+.SH AUTHORS
+.PP
+Technical Suwako (developer)
+Remilia Scarlet (English translation)
パスワード一覧を表示
.TP
\fB\,o\fR \fI\,password\fR
-ワンタイムパスワード(TOTP)を表示。存在しなければ、創作する
+ワンタイムパスワード(TOTP)を表示
.TP
\fB\,s\fR \fI\,password\fR
パスワードを表示
バージョンを表示
.TP
\fB\,y\fR \fI\,password\fR
-パスワードを表示せずクリップボードにコピーする
+パスワードを表示せずクリップボードにコピーする(Xorgのみ)
.SH LANGUAGE
デフォルトの言語は日本語ですが、英語で利用するには、
.br
.Ed
.SH AUTHORS
.PP
-テクニカル諏訪子
+テクニカル諏訪子(開発者)
+レミリア・スカーレット(英訳)
char *homedir = getenv("HOME");
if (homedir == NULL) {
if (strncmp(lang, "en", 2) == 0)
- perror("Failed to retrieving home directory");
+ perror("Failed to retrieve home directory");
else perror("ホームディレクトリを受取に失敗");
return;
}
char *gpgpathchk = malloc(alllen);
if (gpgpathchk == NULL) {
if (strncmp(lang, "en", 2) == 0)
- perror("Failed to allocating memory");
+ perror("Failed to allocate memory");
else perror("メモリを割当に失敗");
return;
}
if (strncmp(lang, "en", 2) == 0)
fprintf(
stderr,
- "Password already exist.\nFor edit, please run ' sp -e %s '.\n",
+ "Password already exist.\nTo edit, please run ' sp -e %s '.\n",
file
);
else
// パスワードが一致するかどうか確認
if (strcmp(pass, knin) != 0) {
if (strncmp(lang, "en", 2) == 0)
- perror("Password does not match. Ending...");
+ perror("Password does not match. Terminating...");
else perror("パスワードが一致していません。終了…");
return;
}
err = gpgme_new(&ctx);
if (err) {
if (strncmp(lang, "en", 2) == 0)
- fprintf(stderr, "Failed to generating GPGME: %s\n", gpgme_strerror(err));
+ fprintf(stderr, "Failed to generate GPGME: %s\n", gpgme_strerror(err));
else fprintf(stderr, "GPGMEを創作に失敗:%s\n", gpgme_strerror(err));
return;
}
err = gpgme_set_pinentry_mode(ctx, GPGME_PINENTRY_MODE_LOOPBACK);
if (err) {
if (strncmp(lang, "en", 2) == 0)
- fprintf(stderr, "Failed to setting pinentry mode: %s\n", gpgme_strerror(err));
+ fprintf(stderr, "Failed to set pinentry mode: %s\n", gpgme_strerror(err));
else fprintf(stderr, "pinentryモードを設定に失敗: %s\n", gpgme_strerror(err));
gpgme_release(ctx);
return;
err = gpgme_data_new_from_mem(&in, pass, strlen(pass), 0);
if (err) {
if (strncmp(lang, "en", 2) == 0)
- fprintf(stderr, "Failed to making data object: %s\n", gpgme_strerror(err));
+ fprintf(stderr, "Failed to make data object: %s\n", gpgme_strerror(err));
else
fprintf(stderr, "データオブジェクトを創作に失敗: %s\n", gpgme_strerror(err));
gpgme_release(ctx);
FILE* keyfile = fopen(keypath, "rb");
if (keyfile == NULL) {
if (strncmp(lang, "en", 2) == 0) {
- perror("Failed to opening .gpg-id file");
+ perror("Failed to open .gpg-id file");
fprintf(stderr, "Failed path: %s\n", keypath);
} else {
perror(".gpg-idファイルを開くに失敗");
err = gpgme_get_key(ctx, keyid, &key[0], 0);
if (err) {
if (strncmp(lang, "en", 2) == 0)
- fprintf(stderr, "Failed to getting key: %s\n", gpgme_strerror(err));
+ fprintf(stderr, "Failed to get key: %s\n", gpgme_strerror(err));
else fprintf(stderr, "鍵を受取に失敗: %s\n", gpgme_strerror(err));
free(keyid);
return;
if (gpgpath == NULL) {
cleanup(ctx, key[0], in, out);
if (strncmp(lang, "en", 2) == 0)
- perror("Failed to allocating memory");
+ perror("Failed to allocate memory");
else perror("メモリを割当に失敗");
return;
}
free(gpgpath);
cleanup(ctx, key[0], in, out);
if (strncmp(lang, "en", 2) == 0)
- perror("Failed to constructing directory");
+ perror("Failed to create directory");
else perror("ディレクトリを創作に失敗");
return;
}
free(gpgpath);
cleanup(ctx, key[0], in, out);
if (strncmp(lang, "en", 2) == 0)
- perror("Password is already exist");
+ perror("Password already exists");
else perror("パスワードは既に存在しています");
return;
}
gpgfile = fopen(gpgpath, "wb");
if (gpgfile == NULL) {
if (strncmp(lang, "en", 2) == 0) {
- perror("Failed to opening file.");
+ perror("Failed to open file.");
fprintf(stderr, "Failed path: %s\n", gpgpath);
} else {
perror("ファイルを開くに失敗。");
ssize_t encrypted_data_size = gpgme_data_seek(out, 0, SEEK_END);
if (encrypted_data_size <= 0) {
if (strncmp(lang, "en", 2) == 0)
- perror("Failed to saving the data");
+ perror("Failed to store the data");
else perror("データを保存に失敗");
fclose(gpgfile);
free(gpgpath);
while ((read_bytes = gpgme_data_read(out, buffer, sizeof(buffer))) > 0) {
if (fwrite(buffer, 1, (size_t)read_bytes, gpgfile) != (size_t)read_bytes) {
if (strncmp(lang, "en", 2) == 0)
- perror("Failed to writing password");
+ perror("Failed to write password");
else perror("パスワードを書き込みに失敗");
free(gpgpath);
cleanup(ctx, key[0], in, out);
cleanup(ctx, key[0], in, out);
if (strncmp(lang, "en", 2) == 0)
- puts("I could save the password");
+ puts("The password got saved.");
else puts("パスワードを保存出来ました");
}
char *homedir = getenv("HOME");
if (homedir == NULL) {
if (strncmp(lang, "en", 2) == 0)
- perror("Failed to getting home directory");
+ perror("Failed to get home directory");
else perror("ホームディレクトリを受取に失敗");
return -1;
}
char *gpgpathchk = malloc(alllen);
if (gpgpathchk == NULL) {
if (strncmp(lang, "en", 2) == 0)
- perror("Failed to allocating memory");
+ perror("Failed to allocate memory");
else perror("メモリを割当に失敗");
return -1;
}
// 削除を確認する
if (force == 0) { // パスワードの変更の場合、確認は不要
if (strncmp(lang, "en", 2) == 0)
- printf("Is it really good if I delete the password '%s'? (y/N): ", file);
+ printf("Are you sure you want to delete the password '%s'? (y/N): ", file);
printf("パスワード「%s」を本当に削除する事が宜しいでしょうか? (y/N): ", file);
int confirm = getchar();
if (confirm != 'y' && confirm != 'Y') {
if (unlink(pwfile) == -1) {
if (strncmp(lang, "en", 2) == 0)
- perror("Password cannot be delete");
+ perror("Password cannot be deleted");
else perror("パスワードを削除出来ませんですた");
return -1;
}
// sp -e の場合、「パスワードを削除しました」って要らない
if (force == 1) return 0;
- if (strncmp(lang, "en", 2) == 0) puts("Deleted password");
+ if (strncmp(lang, "en", 2) == 0) puts("The password got deleted");
else puts("パスワードを削除しました");
return 0;
FILE *fp = fopen("/dev/random", "rb");
if (fp == NULL) {
if (strncmp(lang, "en", 2) == 0)
- perror("Could not opening /dev/random");
+ perror("Could not open /dev/random");
else perror("/dev/randomを開けられませんでした");
exit(EXIT_FAILURE);
}
char *homedir = getenv("HOME");
if (homedir == NULL) {
if (strncmp(lang, "en", 2) == 0)
- perror("Failed to getting home directory.");
+ perror("Failed to get home directory.");
else perror("ホームディレクトリを受取に失敗。");
return;
}
if (mkdir_r(dirpath, 0755) != 0 && errno != EEXIST) {
if (strncmp(lang, "en", 2) == 0)
- perror("Failed to creating directory.");
+ perror("Failed to create directory.");
else perror("ディレクトリを作成に失敗。");
return;
}
struct stat statbuf;
if (stat(gpgidpath, &statbuf) == 0) {
if (strncmp(lang, "en", 2) == 0)
- perror(".gpg-id file is already exist.");
+ perror(".gpg-id file already exists.");
else perror(".gpg-idファイルは既に存在します。");
return;
}
FILE *gpgidfile = fopen(gpgidpath, "w");
if (gpgidfile == NULL) {
if (strncmp(lang, "en", 2) == 0)
- perror("Failed to writing .gpg-id file.");
+ perror("Failed to write .gpg-id file.");
else perror(".gpg-idファイルを書き込めません。");
fclose(gpgidfile);
return;
if (fputs(gpgid, gpgidfile) == EOF) {
if (strncmp(lang, "en", 2) == 0)
- perror("Failed to writing .gpg-id file.");
+ perror("Failed to write .gpg-id file.");
else perror(".gpg-idファイルへの書き込みに失敗しました。");
fclose(gpgidfile);
return;
fclose(gpgidfile);
if (strncmp(lang, "en", 2) == 0)
- puts("First time setup was complete.");
+ puts("Initialization completed.");
else puts("初期設定に完了しました。");
}
DIR* dir = opendir(basePath);
if (!dir) {
if (strncmp(lang, "en", 2) == 0)
- perror("Could not opening directory");
+ perror("Could not open directory");
else perror("ディレクトリを開けられません");
return;
}
int needed = snprintf(path, sizeof(path), "%s/%s", basePath, entry->d_name);
if (needed >= (int)sizeof(path) || needed < 0) {
if (strncmp(lang, "en", 2) == 0)
- perror("Error: Path is too long, or failed to getting lenth");
+ perror("Error: Path is too long, or failed to get lenth");
else perror("エラー:パスが長すぎる、又は長さを受取に失敗");
continue;
}
struct stat statbuf;
if (stat(path, &statbuf) == -1) {
if (strncmp(lang, "en", 2) == 0)
- perror("Failed to reading file status");
+ perror("Failed to read file status");
else perror("ファイル状況を読込に失敗");
continue;
}
const char *secret_start = strstr(otpauth_url, "secret=");
if (!secret_start) {
if (strncmp(lang, "en", 2) == 0)
- perror("In the middle of the OTPAuth URL, could not found secret");
+ perror("Failed to find secret in the OTPAuth URL");
else perror("OTPAuth URLの中に、シークレットを見つけられませんでした");
return NULL;
}
if (secret_end < secret_start) {
if (strncmp(lang, "en", 2) == 0)
- perror("Illegal secret range");
+ perror("Incorrect secret range");
else perror("不正なシークレットの距離");
return NULL;
}
if (secret_encoded == NULL) {
if (strncmp(lang, "en", 2) == 0)
- perror("Failed to allocating memory");
+ perror("Failed to allocate memory");
else perror("メモリの役割に失敗");
return NULL;
}
if (!secret_decoded) {
if (strncmp(lang, "en", 2) == 0)
- perror("Failed to decrypting of the BASE32");
+ perror("Failed to decrypt BASE32");
else perror("BASE32の復号化に失敗");
return NULL;
}
err = gpgme_new(&ctx);
if (err) {
if (strncmp(lang, "en", 2) == 0)
- perror("Failed to generating the GPG");
- else perror("GPGMEを創作に失敗");
+ perror("Failed to generate the GPG");
+ else perror("GPGを創作に失敗");
exit(1);
}
err = gpgme_data_new_from_file(&in, file, 1);
if (err) {
if (strncmp(lang, "en", 2) == 0)
- perror("Failed to reading the GPG file");
+ perror("Failed to read the GPG file");
else perror("GPGファイルを読込に失敗");
exit(1);
}
err = gpgme_data_new(&out);
if (err) {
if (strncmp(lang, "en", 2) == 0)
- perror("Failed to reading the GPG data");
+ perror("Failed to read the GPG data");
else perror("GPGデータを読込に失敗");
exit(1);
}
err = gpgme_op_decrypt(ctx, in, out);
if (err) {
if (strncmp(lang, "en", 2) == 0)
- perror("Failed to decrypting the GPG");
+ perror("Failed to decrypt the GPG");
else perror("GPGを復号化に失敗");
exit(1);
}
char *secret = gpgme_data_release_and_get_mem(out, &secret_len);
if (!secret) {
if (strncmp(lang, "en", 2) == 0)
- perror("Failed to getting the GPG");
+ perror("Failed to get the GPG");
else perror("GPGを受取に失敗");
exit(1);
}
unsigned char *secret_decoded = extract_secret(secret, &decoded_len);
if (!secret_decoded) {
if (strncmp(lang, "en", 2) == 0)
- perror("Failed to decoding or exporting secret");
+ perror("Failed to decode or export secret");
else perror("シークレットの抽出又はデコードに失敗しました");
free(secret);
exit(1);
err = gpgme_new(&ctx);
if (err) {
if (strncmp(lang, "en", 2) == 0)
- fprintf(stderr, "Failed to generating GPGME: %s\n", gpgme_strerror(err));
+ fprintf(stderr, "Failed to generate GPGME: %s\n", gpgme_strerror(err));
else fprintf(stderr, "GPGMEを創作に失敗:%s\n", gpgme_strerror(err));
return NULL;
}
char *homedir = getenv("HOME");
if (homedir == NULL) {
if (strncmp(lang, "en", 2) == 0)
- perror("Failed to getting home directory");
+ perror("Failed to get home directory");
else perror("ホームディレクトリを受取に失敗");
return NULL;
}
char *gpgpath = malloc(alllen);
if (gpgpath == NULL) {
if (strncmp(lang, "en", 2) == 0)
- perror("Failed to allocating memeory");
+ perror("Failed to allocate memeory");
else perror("メモリを割当に失敗");
return NULL;
}
gpgfile = fopen(gpgpath, "rb");
if (gpgfile == NULL) {
if (strncmp(lang, "en", 2) == 0) {
- perror("Failed to opening file");
+ perror("Failed to open file");
} else {
perror("ファイルを開くに失敗");
}
// ファイルからinデータオブジェクトを創作
if (gpgme_data_new_from_stream(&in, gpgfile) != GPG_ERR_NO_ERROR) {
if (strncmp(lang, "en", 2) == 0)
- perror("Failed to generating the GPGME data object");
+ perror("Failed to generate the GPGME data object");
else perror("GPGMEデータオブジェクトを創作に失敗");
clean_up(ctx, in, out, gpgfile, gpgpath);
return NULL;
// outデータオブジェクトを創作
if (gpgme_data_new(&out) != GPG_ERR_NO_ERROR) {
if (strncmp(lang, "en", 2) == 0)
- perror("Failed to generating the GPGME data object");
+ perror("Failed to generate the GPGME data object");
else perror("GPGMEデータオブジェクトを創作に失敗");
clean_up(ctx, in, out, gpgfile, gpgpath);
return NULL;
err = gpgme_op_decrypt(ctx, in, out);
if (err) {
if (strncmp(lang, "en", 2) == 0)
- fprintf(stderr, "Failed to decrypting: %s\n", gpgme_strerror(err));
+ fprintf(stderr, "Failed to decrypt: %s\n", gpgme_strerror(err));
else fprintf(stderr, "復号化に失敗: %s\n", gpgme_strerror(err));
// 掃除
char *res = malloc(512 * sizeof(char));
if (res == NULL) {
if (strncmp(lang, "en", 2) == 0)
- perror("Failed to allocating memory");
+ perror("Failed to allocate memory");
else perror("メモリを役割に失敗");
clean_up(ctx, in, out, gpgfile, gpgpath);
return NULL;
// Xセッションではない場合(例えば、SSH、TTY、Gayland等)、showpass()を実行して
if (getenv("DISPLAY") == NULL) {
if (strncmp(lang, "en", 2) == 0)
- puts("There is no X session, so executing 'sp -s'.");
+ puts("There is no X session, so running 'sp -s'.");
else puts("Xセッションではありませんので、「sp -s」を実行します。");
showpass(file);
return;
err = gpgme_new(&ctx);
if (err) {
if (strncmp(lang, "en", 2) == 0)
- fprintf(stderr, "Failed to generating GPGME: %s\n", gpgme_strerror(err));
+ fprintf(stderr, "Failed to generate GPGME: %s\n", gpgme_strerror(err));
else fprintf(stderr, "GPGMEを創作に失敗:%s\n", gpgme_strerror(err));
return;
}
char* homedir = getenv("HOME");
if (homedir == NULL) {
if (strncmp(lang, "en", 2) == 0)
- perror("Failed to getting home directory");
+ perror("Failed to get home directory");
else perror("ホームディレクトリを受取に失敗");
return;
}
char* gpgpath = malloc(alllen);
if (gpgpath == NULL) {
if (strncmp(lang, "en", 2) == 0)
- perror("Failed to allocating memory");
+ perror("Failed to allocate memory");
else perror("メモリを割当に失敗");
return;
}
gpgfile = fopen(gpgpath, "rb");
if (gpgfile == NULL) {
if (strncmp(lang, "en", 2) == 0) {
- perror("Failed to opening the file");
+ perror("Failed to open the file");
fprintf(stderr, "Failed path: %s\n", gpgpath);
} else {
perror("ファイルを開くに失敗");
err = gpgme_op_decrypt(ctx, in, out);
if (err) {
if (strncmp(lang, "en", 2) == 0)
- fprintf(stderr, "Failed to decryption: %s\n", gpgme_strerror(err));
+ fprintf(stderr, "Failed to decrypt: %s\n", gpgme_strerror(err));
else fprintf(stderr, "復号化に失敗: %s\n", gpgme_strerror(err));
// 掃除
gpgme_data_release(out);
gpgme_release(ctx);
if (strncmp(lang, "en", 2) == 0)
- perror("Could not found a clipboard");
+ perror("Could not find a clipboard");
else perror("クリップボードを見つけられませんでした");
return;
}
printf(
"%s\n%s\n",
"Added password to the clipboard.",
- "I will take it away from the clipboard after 45 second."
+ "After 45 seconds it'll be deleted from the clipboard."
);
else
printf(