free software resistance
the cost of computing freedom is eternal vigilance
### arrname.fig
*original date:* dec 2015
*originally posted:* sep 2024
arrname.fig:
```
#### license: creative commons cc0 1.0 (public domain)
#### [http://creativecommons.org/publicdomain/zero/1.0/](http://creativecommons.org/publicdomain/zero/1.0/)
proginf = "arrname 0.1 - get dirname, filename, ext from stdin"
# this program is FREE SOFTWARE and comes with NO WARRANTY
# usage: | arrname __
# __ 1=dir 2=name 3=ext
function re(z p)
f=z ; split(f p) ; join(f "") ; return(f)
fig
function dir(z, m)
ln = z len
r = z reverse
dloc = instr(r, "/")
prdir "" # is the folder name
iftrue dloc
ifmore ln 1
dl = ln minus dloc
prdir = z left dl
ifequal prdir ""
prdir "/"
fig
else
dok = instr("/", z)
iftrue dok
prdir = z
fig
fig
else
prdir = " " plus z
z = prdir
prdir = ""
fig
ifequal m 1
z prdir ltrim return z
fig
prname # name of file
dl = dloc minus 1
prname = z right dl
floc = prname reverse instr(floc ".")
fl = prname len minus floc
pn = prname ltrim
iftrue floc
pn = prname left fl ltrim
fig
ifequal m 2
z return pn
fig
pext "" # name of extension
iftrue floc
pn = prname right floc
pext = pn
fig
ifequal m 3
z return pext
fig
fig
try
c = command mid 1 1 val
except
p end
resume
forin (p stdin)
cr=13 ; chr
lf=10 ; chr
z=p ; re(z cr) ; re(z lf)
p=z dir(z, c) print
next
```
license: 0-clause bsd
```
# 2015 mn
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
```
=> https://freesoftwareresistance.neocities.org