From b6fa21524507cb5f9909a768f341301251b399e1 Mon Sep 17 00:00:00 2001 From: b Date: Sat, 10 Jun 2023 08:03:11 +0000 Subject: [PATCH] post edit by ID option. build url. --- botm-common | 2 +- sendpost.1.pl | 37 ++++++++++--------------------------- 2 files changed, 11 insertions(+), 28 deletions(-) diff --git a/botm-common b/botm-common index 5eb6fff..148c226 160000 --- a/botm-common +++ b/botm-common @@ -1 +1 @@ -Subproject commit 5eb6fff2ecca3f68b44aeffcfaf10663a9e72502 +Subproject commit 148c2263126c655c3f457c7552842113babe19a0 diff --git a/sendpost.1.pl b/sendpost.1.pl index f1bd7fc..dda1ce9 100644 --- a/sendpost.1.pl +++ b/sendpost.1.pl @@ -23,9 +23,7 @@ use Encode qw(encode decode); ###PERL_LIB: use lib '/botm/lib/post'; use botm_common ( 'read_data_file', 'write_data_file', - 'url_encode', 'url_decode', - 'join_path', - 'html_entity_decode' + 'merge_url', ); ###PERL_ENCODING_FILE_IN: use constant ENCODING_FILE_IN => 'UTF-8'; @@ -45,6 +43,7 @@ use constant HELP_TEXT => " -p, --password=PASSWORD\n". " -t, --subject=POST_SUBJECT\n". " -c, --content=POST_CONTENT\n". + " -e, --edit=POST_ID\n". "\n". " -d, --data-only\n". "\n". @@ -82,6 +81,7 @@ GetOptions ( 'password|p=s' => \$options{'password'}, 'subject|t=s' => \$options{'subject'}, 'content|c=s' => \$options{'content'}, + 'edit|e=s' => \$options{'edit'}, 'data-only|d' => \$options{'data-only'}, @@ -103,25 +103,6 @@ GetOptions ( 'help|h' => \$options{ 'help'} ); -print html_entity_decode( - 'illegal: "&" -' . "\n". - 'name(gt): ">" -' . "\n". - 'name_inf(gta): ">a" -' . "\n". - 'decimal(126): "~" -' . "\n". - 'hexadecimal(7E). "~" -' . "\n". - 'bad names: Y;&enhedksdh; -' . "\n". - 'finally, some text :> -' -)."\n"; - - -# print html_entity_encode_dec ('')."\n"; -# print html_entity_encode_hex ('')."\n"; -# print html_entity_encode_name('')."\n"; -# print html_entity_encode_dec ('', 1)."\n"; -# print html_entity_encode_hex ('', 1)."\n"; -# print html_entity_encode_name('', 1)."\n"; -exit 0; - if ($options{'help'} ne '') { print HELP_TEXT; exit 0; @@ -130,13 +111,13 @@ if ($options{'mirror-url'} eq '') { $options{'mirror-url'} = MIRROR_URL; } +post_to_mirror(); +exit 0; + print "options:\n"; my $a = write_data_file(\*STDOUT, ENCODING_STD_OUT, 0, \%options); print "$a\n"; -foreach my $ind (keys %options) { - print $ind.'=>'.url_decode($options{$ind})."<\n"; -} -print; + foreach my $arg (@ARGV) { print "\nFILE $arg\n"; my %data = read_data_file($arg, 'utf8', 1); @@ -274,6 +255,8 @@ sub prepare_post { sub post_to_mirror { (my $cmd_options, my $post) = @_; - my $post_url = join_path('/', $cmd_options->{'mirror-url'}, 'post'); + my $post_url = merge_url($options{'mirror-url'}, 'post'); + + print $post_url."\n"; } -- 2.30.2