author | Olivier Brunel
<jjk@jjacky.com> 2017-06-18 12:44:24 UTC |
committer | Olivier Brunel
<jjk@jjacky.com> 2017-06-18 12:44:35 UTC |
parent | 0d78e895f72392b4b3f870aa284e489dec5e361c |
doc/aa-mvlog.pod | +0 | -40 |
package/modes | +0 | -1 |
package/targets.mak | +0 | -2 |
src/utils/aa-mvlog.c | +0 | -116 |
src/utils/deps-exe/aa-mvlog | +0 | -2 |
diff --git a/doc/aa-mvlog.pod b/doc/aa-mvlog.pod deleted file mode 100644 index 6ce6f1a..0000000 --- a/doc/aa-mvlog.pod +++ /dev/null @@ -1,40 +0,0 @@ -=head1 NAME - -aa-mvlog - Helper to move & rename log file - -=head1 SYNOPSIS - -B<aa-mvlog> [B<-D>] I<LOGFILE> I<DESTDIR> - -=head1 OPTIONS - -=over - -=item B<-D, --double-output> - -Enable double-output mode. Instead of using stdout for regular output, and -stderr for warnings and errors, everything is sent both to stdout and stderr. -This is intended to redirect stderr to a log file, so full output can be both -shown on console and logged. - -=item B<-h, --help> - -Show help screen and exit. - -=item B<-V, --version> - -Show version information and exit. - -=back - -=head1 DESCRIPTION - -B<aa-mvlog>(1) is a small helper to move I<LOGFILE> into I<DESTDIR>, renaming it -to the TAI timestamp read from its first line (i.e. the first 25 bytes of -I<LOGFILE>), and creating in I<DESTDIR> a symlink named I<current> pointing to -it. - -=head2 DEPRECATION WARNING - -Please note that B<aa-mvlog>(1) has been deprecated and will be removed in the -next version of B<anopa>. diff --git a/package/modes b/package/modes index c81dc93..21405c4 100644 --- a/package/modes +++ b/package/modes @@ -6,7 +6,6 @@ aa-enable 0755 aa-incmdline 0755 aa-kill 0755 aa-mount 0755 -aa-mvlog 0755 aa-pivot 0755 aa-reboot 0755 aa-reset 0755 diff --git a/package/targets.mak b/package/targets.mak index 3ffe31b..dbcabb6 100644 --- a/package/targets.mak +++ b/package/targets.mak @@ -6,7 +6,6 @@ aa-enable \ aa-incmdline \ aa-kill \ aa-mount \ -aa-mvlog \ aa-pivot \ aa-reboot \ aa-reset \ @@ -42,7 +41,6 @@ aa-enable.1 \ aa-incmdline.1 \ aa-kill.1 \ aa-mount.1 \ -aa-mvlog.1 \ aa-pivot.1 \ aa-reboot.1 \ aa-reset.1 \ diff --git a/src/utils/aa-mvlog.c b/src/utils/aa-mvlog.c deleted file mode 100644 index 50c4013..0000000 --- a/src/utils/aa-mvlog.c +++ /dev/null @@ -1,116 +0,0 @@ -/* - * anopa - Copyright (C) 2015-2017 Olivier Brunel - * - * aa-mvlog.c - * Copyright (C) 2015-2017 Olivier Brunel <jjk@jjacky.com> - * - * This file is part of anopa. - * - * anopa is free software: you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation, either version 3 of the License, or (at your option) any later - * version. - * - * anopa is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * anopa. If not, see http://www.gnu.org/licenses/ - */ - -#include <getopt.h> -#include <sys/stat.h> -#include <unistd.h> -#include <skalibs/djbunix.h> -#include <skalibs/bytestr.h> -#include <anopa/common.h> -#include <anopa/output.h> -#include <anopa/copy_file.h> - -static void -dieusage (int rc) -{ - aa_die_usage (rc, "[OPTION] LOGFILE DESTDIR", - " -D, --double-output Enable double-output mode\n" - " -h, --help Show this help screen and exit\n" - " -V, --version Show version information and exit\n" - ); -} - -int -main (int argc, char * const argv[]) -{ - PROG = "aa-mvlog"; - struct stat st; - - for (;;) - { - struct option longopts[] = { - { "double-output", no_argument, NULL, 'D' }, - { "help", no_argument, NULL, 'h' }, - { "version", no_argument, NULL, 'V' }, - { NULL, 0, 0, 0 } - }; - int c; - - c = getopt_long (argc, argv, "DhV", longopts, NULL); - if (c == -1) - break; - switch (c) - { - case 'D': - aa_set_double_output (1); - break; - - case 'h': - dieusage (0); - - case 'V': - aa_die_version (); - - default: - dieusage (1); - } - } - argc -= optind; - argv += optind; - - if (argc != 2) - dieusage (1); - - if (stat (argv[0], &st) < 0) - aa_strerr_diefu2sys (2, "stat ", argv[0]); - else if (!S_ISREG (st.st_mode)) - aa_strerr_dief2x (2, argv[0], ": not a file"); - - { - size_t l = strlen (argv[1]); - char newname[l + 27]; - char target[26]; - - byte_copy (newname, l, argv[1]); - newname[l] = '/'; - if (openreadnclose (argv[0], newname + l + 1, 25) != 25) - aa_strerr_diefu2sys (2, "read new name from ", argv[0]); - if (newname[l + 1] != '@' - || byte_chr (newname + l + 1, 25, '/') < 25 - || byte_chr (newname + l + 1, 25, '\0') < 25) - aa_strerr_dief2x (2, "invalid new name read from ", argv[0]); - newname[l + 26] = '\0'; - - if (aa_copy_file (argv[0], newname, st.st_mode, AA_CP_CREATE) < 0) - aa_strerr_diefu4sys (2, "copy ", argv[0], " as ", newname); - - byte_copy (target, 26, newname + l + 1); - byte_copy (newname + l + 1, 8, "current"); - unlink (newname); - if (symlink (target, newname) < 0) - aa_strerr_warnu2sys ("create symlink ", newname); - if (unlink (argv[0]) < 0) - aa_strerr_warnu2sys ("remove source file ", argv[0]); - } - - return 0; -} diff --git a/src/utils/deps-exe/aa-mvlog b/src/utils/deps-exe/aa-mvlog deleted file mode 100644 index 30987b4..0000000 --- a/src/utils/deps-exe/aa-mvlog +++ /dev/null @@ -1,2 +0,0 @@ -${LIBANOPA} --lskarnet