diff options
Diffstat (limited to 'urldecode')
-rwxr-xr-x | urldecode | 24 |
1 files changed, 9 insertions, 15 deletions
@@ -1,16 +1,10 @@ -#!/bin/bash -arg="$1" -i="0" -while [ "$i" -lt ${#arg} ]; do - c0=${arg:$i:1} - if [ "x$c0" = "x%" ]; then - c1=${arg:$((i+1)):1} - c2=${arg:$((i+2)):1} - printf "\x$c1$c2" - i=$((i+3)) - else - echo -n "$c0" - i=$((i+1)) - fi -done +#!/usr/bin/php +<?php +if (count($argv) == 0) { + echo urldecode(file_get_contents("php://stdin")); +} else { + foreach ($argv as $arg) { + echo urldecode(file_get_contents($arg)); + } +} |