summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--Makefile13
-rw-r--r--fb.1148
-rw-r--r--fb.pod82
4 files changed, 153 insertions, 91 deletions
diff --git a/.gitignore b/.gitignore
index e25dfe7..9d5b96a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,3 @@
dist
-fb.1
fb
fb-helper
diff --git a/Makefile b/Makefile
index 3647e89..5884b00 100644
--- a/Makefile
+++ b/Makefile
@@ -8,9 +8,9 @@ CFLAGS?=-O2 -std=c99 -Wall -Wextra -pedantic
LIBCURL:=$(shell pkg-config --silence-errors --libs --cflags libcurl)
ifdef LIBCURL
-all: fb.1 fb fb-helper
+all: fb fb-helper
else
-all: fb.1 fb
+all: fb
endif
fb: fb.in
@@ -21,14 +21,11 @@ fb: fb.in
fb-helper: fb-helper.c
$(CC) $(CFLAGS) $(LIBCURL) -DVERSION=\"$(VERSION)\" -o $@ $<
-fb.1: fb.pod
- pod2man -c "" $< $@
-
clean:
- rm -f fb.1 fb fb-helper
+ rm -f fb fb-helper
rm -rf dist
-install: all
+install:
install -dm755 $(DESTDIR)$(BINDIR)
install -m755 fb $(DESTDIR)$(BINDIR)/fb
ifdef LIBCURL
@@ -46,7 +43,7 @@ uninstall:
dist: all
@[ -n "$(VERSION)" ] || (echo "Error: version detection failed"; exit 1)
mkdir -p dist/fb-$(VERSION)
- cp -a fb-helper.c fb{,.in} fb.pod fb.1 COPYING Makefile dist/fb-$(VERSION)
+ cp -a fb-helper.c fb{,.in} fb.1 COPYING Makefile dist/fb-$(VERSION)
sed -i 's/^VERSION:=.*$$/VERSION:='$(VERSION)'/' dist/fb-$(VERSION)/Makefile
cd dist; tar -czf fb-$(VERSION).tar.gz fb-$(VERSION)
diff --git a/fb.1 b/fb.1
new file mode 100644
index 0000000..2607bf4
--- /dev/null
+++ b/fb.1
@@ -0,0 +1,148 @@
+.\" Copyright (c) 2010 Florian Pritz, flo at xssn.at
+.\" 2011 Moritz Wilhelmy, mw at wzff.de
+.\"
+.\" DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
+.\" Version 2, December 2004
+.\"
+.\" 14 rue de Plaisance, 75014 Paris, France
+.\" Everyone is permitted to copy and distribute verbatim or modified
+.\" copies of this license document, and changing it is allowed as long
+.\" as the name is changed.
+.\"
+.\" DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
+.\" TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+.\"
+.\" 0. You just DO WHAT THE FUCK YOU WANT TO.
+.\"
+.Dd September 12, 2011
+.Dt FB 1
+.Os
+.Sh NAME
+.Nm fb
+.Nd a shell-script client for http://paste.xinu.at
+.Sh SYNOPSIS
+.Nm
+.Ar file/directory ...
+.Nm
+.Op Fl dg
+.Ar ID/URL ...
+.Nm
+.Op Fl hv
+.Sh DESCRIPTION
+.Nm
+is a client to http://paste.xinu.at which allows the user to easily upload,
+delete or download files.
+By default, files will be uploaded as-is and a link to the file will be printed
+to stdout after each upload.
+.Pp
+Before terminating,
+.Nm
+will try to copy all links into the X clipboard if
+.Xr xclip 1
+is installed.
+Folders will be packed into a tarball with
+.Xr tar 1 and the resulting
+.Pa upload.tar
+file will be uploaded.
+If no arguments are given, data will be read from stdin into a temporary file
+that will be uploaded as soon as EOF is received..
+If the file being uploaded is bigger than 10MB
+.Nm
+will query the server for the maximum upload size and abort the upload if the
+file would be rejected.
+.Pp
+Following options are supported:
+.Bl -tag -width Ds
+.It Fl d
+Delete the IDs. You can no longer upload files in this mode. If the argument is a URL,
+.Nm
+will try to extract the ID.
+.It Fl g
+Download the IDs and output on stdout. Please take care when using this, as
+binary data may cause unexpected results when being output directly to a
+terminal. You can no longer upload files in this mode. If the argument is a
+URL,
+.Nm
+will try to extract the ID.
+.It Fl h
+Display a short help message.
+.It Fl v
+Display the client version.
+.It Fl e Ar extension
+Change the extension used for highlighting. You can also do this if you
+have already uploaded the file by appending the extension to the URL.
+http://paste.xinu.at/<ID>/bash will change the syntax highlighting to bash.
+.It Fl t
+Upload a tar file containing all files and directories specified on the
+command line.
+.It Fl c
+Compress the files to be uploaded using
+.Xr gzip 1 .
+This affects all files including piped content and folders.
+If specified twice,
+.Xr xz 1
+will be used rather than gzip.
+.El
+.Pp
+If you want to be able to delete files, you have to add the following lines to
+.Pa ~/.netrc :
+.Pp
+.Bd -literal -offset indent
+machine paste.xinu.at
+ password <your_secret_password>
+.Ed
+.Sh ENVIRONMENT
+Some options can be changed by modifying environment variables:
+.Bl -tag -width XZ_OPTS
+.It Ev GZIP
+Assigning GZIP will make the gzip-program treat it's value as if they had been
+appended to the command line.
+.It Ev XZ_OPTS
+The XZ_OPTS environment variable can be used in order to pass additional
+options to xz, in case xz is used for compression.
+.It TMPDIR
+Setting TMPDIR to some directory where
+.Nm
+create temporary files inside this directory rather than /tmp, if the
+underlying mktemp program supports it.
+.Sh EXAMPLES
+.Bl -tag
+.It Nm Fl tc Ar folder file
+This will create a .tar archive containing the folder and the file and compress
+it using gzip and upload one archive.
+.It Nm Fl c Ar folder file
+This will create a .tar archive containing only the folder. Both (folder and
+file) will be compressed using gzip and uploaded independently.
+.It Nm Fl cc Ar folder
+This will create a .tar archive containing only the folder and compress it using xz.
+.It Ic make \&|\&& Nm
+This will upload the output of make (stdout and stderr) in csh and similar shells.
+.El
+.Sh SEE ALSO
+.Xr curl 1 ,
+.Xr gzip 1 ,
+.Xr mktemp 1 ,
+.Xr tar 1 ,
+.Xr xz 1 ,
+.Xr xclip 1
+.Sh AUTHORS
+.An -nosplit
+.Nm
+was written by
+.Bl -bullet -compact
+.It
+.\" mdoc has clever spam protection ;)
+.An Florian Pritz Aq fl\&o@xssn.at
+.It
+.An Moritz Wilhelmy Aq mor\&itz@wzff.de
+.El
+and may be copied under the terms of the WTFPL.
+.Sh BUGS
+curl has a nasty comma expansion bug.
+When filenames containing a comma are being uploaded, The main branch tries to
+address this problem by providing a binary helper that links against libcurl in
+order to work around this bug.
+The legacy branch, from which this version of fb was obtained is supposed to
+remain a plain shell-script client, focusing on fixing all fixable bugs
+(i.e. not the curl one) and making it work on all POSIX platforms by removing
+code that only works with GNU bash.
diff --git a/fb.pod b/fb.pod
deleted file mode 100644
index cf8221e..0000000
--- a/fb.pod
+++ /dev/null
@@ -1,82 +0,0 @@
-=head1 NAME
-
-C<fb> - a client for http://paste.xinu.at
-
-=head1 SYNOPSIS
-
-fb [switches] [options] [<file(s)|ID(s)|folder(s)>]
-
-=head1 DESCRIPTION
-
-C<fb> is a client to http://paste.xinu.at which allows the user to easily upload,
-delete or download files.
-
-By default, files will be uploaded as-is and a link to the file will be printed
-to stdout after each upload. At the end C<fb> will try to copy all links into the
-X clipboard if xclip is installed.
-
-Folders will be tar'ed and the resulting upload.tar file will be uploaded.
-
-If no arguments are given, C<fb> will read data from stdin into a temporary file
-that will be uploaded once EOF is received.
-
-If the file being uploaded is bigger than 10MB C<fb> will query the server for the
-maximum upload size and abort the upload if the file would be rejected.
-
-If you want to be able to delete files, you have to add the following line to ~/.netrc
- machine paste.xinu.at password <your_secret_password>
-
-=head1 SWITCHES
-
--d <ID(s)>
- Delete the IDs. You can no longer upload files in this mode.
- If the argument is a URL, C<fb> will try to extract the ID.
-
--g <ID(s)>
- Download the IDs and output on stdout. Please take care when using this,
- as binary data may cause unexpected results when being output directly
- to a terminal. You can no longer upload files in this mode.
- If the argument is a URL, C<fb> will try to extract the ID.
-
--h
- Display a short help message.
-
--v
- Display the client version.
-
-
-=head1 OPTIONS
-
--e <extension>
- Change the extension used for highlighting. You can also do this if you
- have already uploaded the file by appending the extension to the URL.
- http://paste.xinu.at/<ID>/bash will change the syntax highlighting to bash.
-
--t
- Upload a tar file containing all files and directories specified on the
- command line.
-
--c
- Enable compression of the uploaded files. This affects all files including
- piped content and folders.
-
- Specify this option once to use gzip or two times to use xz.
-
- If used in conjunction with the -g switch this decompresses the download
- before it's output to stdout.
-
-=head1 EXAMPLES
-
-fb -tc <folder> <file>
- This will create a .tar archive containing the folder and the file and compress
- it using gzip and upload one archive.
-
-fb -c <folder> <file>
- This will create a .tar archive containing only the folder. Both (folder and file)
- will be compressed using gzip and uploaded independently.
-
-fb -cc <folder>
- This will create a .tar archive containing only the folder and compress it using xz.
-
-make |& fb
- This will upload the output of make (stdout and stderr).