BIN_PATH = /botm/bin/test-post
LIB_PATH = /botm/lib/test-post
+TMP_PATH = /botm/tmp/test-post
CONFIGFILE = settings-$(TARGET).txt settings.txt
DIR=\
$(BIN_PATH)\
-$(LIB_PATH)
+$(LIB_PATH)\
+$(TMP_PATH)
+
+HIDDEN_DIR=\
+$(TMP_PATH)
SETUID=
mktree:
$(MKDIR) -p $(DIR)
-# $(CHMOD) g-r,g-w,g-x,o-r,o-w,o-x $(HIDDEN_DIR)
+ $(CHMOD) g-r,g-w,g-x,o-r,o-w,o-x $(HIDDEN_DIR)
ifdef BIN_PATH
cp_bin: $(BIN) setuid exec | mktree
\r
###MAKE_BIN_PATH: BIN_PATH = /botm/bin/post\r
###MAKE_LIB_PATH: LIB_PATH = /botm/lib/post\r
+###MAKE_TMP_PATH: TMP_PATH = /botm/tmp/post\r
\r
\r
CONFIGFILE = settings-$(TARGET).txt settings.txt\r
\r
DIR=\\r
$(BIN_PATH)\\r
-$(LIB_PATH)\r
+$(LIB_PATH)\\r
+$(TMP_PATH)\r
+\r
+HIDDEN_DIR=\\r
+$(TMP_PATH)\r
\r
SETUID=\r
\r
\r
mktree:\r
$(MKDIR) -p $(DIR)\r
-# $(CHMOD) g-r,g-w,g-x,o-r,o-w,o-x $(HIDDEN_DIR)\r
+ $(CHMOD) g-r,g-w,g-x,o-r,o-w,o-x $(HIDDEN_DIR)\r
\r
ifdef BIN_PATH\r
cp_bin: $(BIN) setuid exec | mktree\r
use botm_common (
'read_data_file', 'write_data_file',
'merge_url',
+ 'make_temp_path'
);
###PERL_ENCODING_FILE_IN: use constant ENCODING_FILE_IN => 'UTF-8';
###PERL_DEFAULT_SUBJECT: use constant DEFAULT_SUBJECT => 'Re: 1190: "Time"';
###PERL_DEFAULT_USERNAME: use constant DEFAULT_USERNAME => 'username';
+###PERL_TMP_PATH: use constant TMP_PATH => '/botm/tmp/post';
+
###PERL_MIRROR_URL: use constant MIRROR_URL => 'https://1190.bicyclesonthemoon.info/ott';
use constant HELP_TEXT =>
$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";
+# print "OPTIONS:\n";
+# my $a = write_data_file(\*STDOUT, ENCODING_STD_OUT, 0, \%options);
-foreach my $arg (@ARGV) {
- print "\nFILE $arg\n";
- my %data = read_data_file($arg, 'utf8', 1);
- foreach my $ind (keys %data) {
- print $ind.'='.$data{$ind}."\n";
- }
+if ((scalar @ARGV) == 0) {
+ @ARGV = (\*STDIN);
}
-# if ((scalar @ARGV) == 0) {
- # print "\nSTDIN\n";
- # my $fh;
- # my %data = read_data_file(\*STDIN, 'utf8', 1);
+
+foreach my $arg (@ARGV) {
+ # print "\nFILE $arg\n";
+ my %data = read_data_file($arg, ENCODING_FILE_IN, $options{'data-only'});
# foreach my $ind (keys %data) {
# print $ind.'='.$data{$ind}."\n";
# }
-# }
+
+ my %post = prepare_post(\%options, \%data);
+ # foreach my $ind (keys %post) {
+ # print $ind.'='.$post{$ind}."\n";
+ # }
+
+ # unless ($options{'mirror'}) {
+ # if (post_to_ott (\%options, \%post)) {
+ # next;
+ # }
+ # }
+ unless ($options{'no-mirror'}) {
+ post_to_mirror(\%options, \%post);
+ }
+}
+
+
+
+
sub prepare_post {
(my $cmd_options, my $file_data) = @_;
sub post_to_mirror {
(my $cmd_options, my $post) = @_;
- my $post_url = merge_url($options{'mirror-url'}, 'post');
+ my $post_url = merge_url($cmd_options->{'mirror-url'}, 'post');
+
+ my $tmp_path = make_temp_path(TMP_PATH, 'sendpost.htm');
+ my $cookie_path = make_temp_path(TMP_PATH, 'sendpost.cookie.txt');
+ my $postdata_path = make_temp_path(TMP_PATH, 'sendpost.postdata.txt');
+
print $post_url."\n";
+ print $tmp_path."\n";
+ print $cookie_path."\n";
+ print $postdata_path."\n";
}
MAKE_BIN_PATH = BIN_PATH = $bin_path
MAKE_LIB_PATH = LIB_PATH = $lib_path
+MAKE_TMP_PATH = TMP_PATH = $tmp_path
PERL_DEFAULT_PASSWORD = @_PERL_CONSTANT_STR( DEFAULT_PASSWORD , $default_password)
PERL_ENCODING_FILE_OUT = @_PERL_CONSTANT_STR( ENCODING_FILE_OUT, $encoding_file_out)
PERL_ENCODING_STD_IN = @_PERL_CONSTANT_STR( ENCODING_STD_IN , $encoding_std_in)
PERL_ENCODING_STD_OUT = @_PERL_CONSTANT_STR( ENCODING_STD_OUT , $encoding_std_out)
-PERL_MIRROR_URL = @_PERL_CONSTANT_STR( MIRROR_URL , $mirror_url);
+PERL_MIRROR_URL = @_PERL_CONSTANT_STR( MIRROR_URL , $mirror_url)
+PERL_TMP_PATH = @_PERL_CONSTANT_STR( TMP_PATH , $tmp_path)
-PERL_LIB = @_PERL_USE_2(lib, '$lib_path')
+PERL_LIB = @_PERL_USE_2(lib, @_PERL_STR($lib_path))
RUN_PERL = @_SHEBANG($perl)
\ No newline at end of file