Skip to content
This repository has been archived by the owner on Feb 19, 2020. It is now read-only.

clidocs

Lars Kellogg-Stedman edited this page Feb 27, 2011 · 7 revisions

Command line utilities

This page presents an overview of the command line tools distributed with python-ftn_. For detailed descriptions of the available options for each command, see the Python documentation. For example:

$ pydoc fidonet.apps.scanmsg

Message manipulation

ftn-scanmsg

The ftn-scanmsg command displays header information from FTS-0001 *.msg files (in either the "on disk" or "packed" formats), and optionally will display the message body.

Example usage:

$ ftn-scanmsg tests/sample.msg
From: Lars @ 322/761
To: Someone Else @ 99/99
Date: 25 Feb 11  21:57:27
Subject: This is a sample message.
Flags:

ftn-querymsg

The ftn-querymsg command is used to extract header information from FTS-0001 *.msg files. It is meant to be used to assist in writing shell scripts that interact with Fidonet style messages.

Example usage:

$ ftn-querymsg -q origNet tests/sample.msg
322

$ ftn-querymsg --qf '%(fromUsername)s -> %(toUsername)s' tests/sample.msg
Lars -> Someone Else

ftn-editmsg

The ftn-editmsg command edits the data contained in a FTS-0001 message header.

Example usage:

$ cp tests/sample.msg work.msg
$ ftn-scanmsg work.msg
From: Lars @ 322/761
To: Someone Else @ 99/99
Date: 25 Feb 11  21:57:27
Subject: This is a sample message.
Flags:
$ ftn-editmsg -t 'The Chief' -f 'The Deputy' -s 'Testing' -d 100/100  work.msg
$ ftn-scanmsg work.msg
From: The Deputy @ 322/761
To: The Chief @ 100/100
Date: 25 Feb 11  21:57:27
Subject: Testing
Flags:

ftn-makemsg

The ftn-makemsg generates an FTS-0001 style message on stdout. By default it creats "packed" messages, you can create "on disk" format messages by padding the --disk option. ftn-makemsg reads a message body on stdin.

Example usage:

$ echo "This is a test." | ftn-makemsg \
    --from 'Lars' \
    --to 'Someone' \
    --orig 1:322/761 \
    --dest 99:99/99 \
    --subject "An exciting subject" \
    --flag killSent \
    --flag private > new.msg
$ ftn-scanmsg new.msg
From: Lars @ 322/761To: Someone @ 99/99
Date: 26 Feb 11  21:37:12
Subject: An exciting subject
Flags: KILLSENT PRIVATE

Packet manipulation

ftn-scanpkt

This command works very much like ftn-scanmsg.

ftn-querypkt

This command works very much like ftn-querymsg.

ftn-editpk

This command works very much like ftn-editmsg.

ftn-pack

The ftn-pack command creates an FSC-0048 mail packet from the specified messages. By default, ftn-pack will create a mail packet named after the hex representation of the destination. You can specify an explicit destination with --out, or you can generate the packet on stdou using the --stdout option.

Example usage:

$ ftn-pack -d 99:99/99 -V tests/sample.msg
... pack:INFO [70074] packed message from Lars @ 322/761 to Someone Else @ 99/99
... pack:INFO [70074] packed 1 messages into 00630063.out.
$ ftn-scanpkt -m 00630063.out
======================================================================
00630063.out:  1:322/761 -> 99:99/99 @ 2011-02-26 21:58:13
======================================================================

[000]
From: Lars @ 322/761
To: Someone Else @ 99/99
Date: 25 Feb 11  21:57:27
Subject: This is a sample message.
Flags:

ftn-unpack

The ftn-unpack command unpacks an FTS-0001 or FSC-0048 (type 2 or type 2+) packet into a series of FTS-0001 message files in your current directory (or into the directory specified with the -d option).

Example usage:

$ ftn-unpack -d tmp -V 00630063.out
unpack:INFO [70087] Unpacked 1 messages from 00630063.out into tmp.
unpack:INFO [70087] Unpacked 1 messages total.

By default the messages are left in the "packed" format, but you can produce "on disk" format messages by adding the --disk option.

Nodelist manipulation

ftn-indexnl

The ftn-indexnl command parses an FTS-5000 nodelist and populates a SQLite database. The default location of the nodelist is read from your fidonet.cfg file.

Example usage:

$ ftn-indexnl -V
2011-02-26 21:45:02 indexnl:INFO [70048] indexing nodelist/nodelist.049

Once the index is complete, you can use the sqlite command line tool to query the nodelist database. For example, to find all nodes in 1:322/* that accept BinkD connections:

sqlite> select address,name,sysop from nodes join flags
   ...> on (parent_id = nodes.id)
   ...> where zone=1 and net=322 and flag_name='IBN';
1:322/320|Lost_Crypt|Rick_Svyzek
1:322/759|The_Zone|Roger_Shays
1:322/761|Somebbs|Lars_Kellogg-stedman
1:322/762|The_American_Connection_BBS|Craig_Gagner
1:322/767|EOS_2|Nikita_Sarychev

To find the mail hub for systems in 1:154/*

sqlite> select address from nodes where zone=1 and net=154 and kw='Hub';
1:154/15