]> bicyclesonthemoon.info Git - ott/post/commitdiff
use botm-common library submodule
authorb <rowerynaksiezycu@gmail.com>
Fri, 12 May 2023 19:14:50 +0000 (19:14 +0000)
committerb <rowerynaksiezycu@gmail.com>
Fri, 12 May 2023 19:14:50 +0000 (19:14 +0000)
.gitmodules [new file with mode: 0644]
botm-common [new submodule]
botm_common.pm [deleted file]
makefile
makefile.1.mak

diff --git a/.gitmodules b/.gitmodules
new file mode 100644 (file)
index 0000000..18429c3
--- /dev/null
@@ -0,0 +1,3 @@
+[submodule "botm-common"]
+       path = botm-common
+       url = ../../botm/common-perl
diff --git a/botm-common b/botm-common
new file mode 160000 (submodule)
index 0000000..341e2e9
--- /dev/null
@@ -0,0 +1 @@
+Subproject commit 341e2e9846e2f68a53b336eb5e741346e82b039e
diff --git a/botm_common.pm b/botm_common.pm
deleted file mode 100644 (file)
index a94f664..0000000
+++ /dev/null
@@ -1,107 +0,0 @@
-# Copyright (C) 2023  Balthasar SzczepaƄski
-# 
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-# 
-# This program 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 Affero General Public License for more details.
-# 
-# You should have received a copy of the GNU Affero General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-package botm_common;
-
-use strict;
-#use warnings;
-use utf8;
-
-use Encode qw(encode decode);
-
-use Exporter;
-use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
-
-$VERSION     = 1.000000;
-@ISA         = qw(Exporter);
-@EXPORT      = ();
-@EXPORT_OK   = qw(readdatafile);
-%EXPORT_TAGS = ();
-
-sub readdatafile {
-       (my $path, my $encoding, my $content_only) = @_;
-       my $file;
-       my %data;
-       my $eoh=0;
-       
-       if ($encoding eq '') {
-               $encoding = 'utf8';
-       }
-       if ($content_only) {
-               $eoh=1;
-       }
-       
-       # check if $path is actually a path or maybe a filehandle
-       # filehandles are references.
-       if(ref($path)) {
-               $file=$path;
-               unless (seek($file, 0, 0)) {
-                       # return %data;
-               }
-       }
-       else {
-               unless (open ($file, "<:$encoding", $path)) {
-                       return %data;
-               }
-       }
-       
-       # The name of header field in previous line. Required for header fields that
-       # occupy multiple lines.
-       my $lastname='';
-       
-       while (defined(my $line = <$file>)) {
-               # $line = decode($encoding, $line);
-               my $name='';
-               my $value='';
-       
-               if ($eoh){
-                       unless($line eq'') {
-                               $data{'content'} = $data{'content'}.$line;
-                       }
-                       next;
-               }
-               
-               $line =~ s/[\n]$//g;
-               
-               # Empty line - end of header.
-               if ($line eq ''){
-                       $eoh=1;
-               }
-               # Line starts with whitespace. It's a continuation of the previous line.
-               # Concatenate the field value, separated by newline.
-               elsif($line =~ /^[ \t](.*)$/){
-                       if($lastname ne '') {
-                               $data{$lastname} .= "\n".$1;
-                       }
-               }
-               # Line starts with a name followed by colon/equal sign. Save the value
-               elsif ($line =~ /^([ -9;-<>-~]+)((:[ \t])|=)(.*)$/) {
-                       $name = lc($1);
-                       $value = $4;
-                       
-                       $data{$name} = $value;
-                       
-                       $lastname = $name;
-               }
-       }
-       # If argument was a path the file must be closed. 
-       unless (ref($path)) {
-               close ($file);
-       }
-       
-       return %data;
-}
-
-1
index e54680c9bb78505c3c54e8965325df63a2b84115..a9cc2c6122e7712faeea27af44739d7cab860636 100644 (file)
--- a/makefile
+++ b/makefile
@@ -57,7 +57,7 @@ BIN=\
 $(EXEC)
 
 LIB=\
-botm_common.pm
+botm-common/botm_common.pm
 
 all: $(BIN)
        
index 71d5d7d1d6d15df584c812ce7a693ad9a9a6c952..772aa5e4e382638b4f8cf806249dcd9448377c96 100644 (file)
@@ -57,7 +57,7 @@ BIN=\
 $(EXEC)\r
 \r
 LIB=\\r
-botm_common.pm\r
+botm-common/botm_common.pm\r
 \r
 all: $(BIN)\r
        \r