Platon Technologies
not logged in Login Registration
EnglishSlovak
open source software development celebrating 10 years of open source development! Thursday, October 15, 2026

Diff for scripts/shell/sms/sity.sk/sms.sh between version 1.14 and 1.15

version 1.14, 2002/06/21 16:23:34 version 1.15, 2002/06/22 15:31:26
Line 18  CONFIG_FILE="$HOME/.sms.sh.conf";
Line 18  CONFIG_FILE="$HOME/.sms.sh.conf";
 ALIAS_FILE="$HOME/.sms.sh.alias";  ALIAS_FILE="$HOME/.sms.sh.alias";
   
 WWW="http://www.sity.sk/pls/sity"  WWW="http://www.sity.sk/pls/sity"
 TMP_FILE1=`tempfile -p sms.sh || mktemp /tmp/sms.shXXXXXX || echo /tmp/sms.sh$$`  TMP_FILE1=`tempfile -p sms. -s .html || mktemp /tmp/sms.XXXX.html || echo /tmp/sms.$$.html`
 TMP_FILE2=`tempfile -p sms.sh || mktemp /tmp/sms.shXXXXXX || echo /tmp/sms.sh$$`  TMP_FILE2=`tempfile -p sms. -s .html || mktemp /tmp/sms.XXXX.html || echo /tmp/sms.$$.html`
   
 if [ $# -lt 1 ]; then  if [ $# -lt 1 ]; then
         echo -e "Usage:\n       $0 <number-or-alias>\n";          echo -e "Usage:\n       $0 <number-or-alias>\n";
Line 36  if [ -z "$number" ]; then
Line 36  if [ -z "$number" ]; then
         if [ -f "$ALIAS_FILE" ]; then          if [ -f "$ALIAS_FILE" ]; then
                 echo "found.";                  echo "found.";
                 echo -n "Looking for alias '$1': ";                  echo -n "Looking for alias '$1': ";
                 number=`grep -v '^#' "$ALIAS_FILE" \  #               number=`grep -v '^#' "$ALIAS_FILE" \
                         | grep -i -E '^'"$1"'[   ]*=?[   ]*' \  #                       | grep -i -E '^'"$1"'[   ]*=?[   ]*' \
                         | sed 's/^'"$1"'[        ]*=\?[         ]*\([0-9]\+\)[   ]*$/\1/i' \  #                       | sed 's/^'"$1"'[        ]*=\?[         ]*\([0-9]\+\)[   ]*$/\1/i' \
                         | head -n 1`;  #                       | head -n 1`;
                   number=`awk "/^#/ { next; } \
                           // { gsub(/=/, \"\"); } \
                           /^$1/ { print \\$2; exit;}" "$ALIAS_FILE"`;
                 if [ "$number" ]; then                  if [ "$number" ]; then
                         echo "found number $number.";                          echo "found number $number.";
                 else                  else
Line 95  if [ -z "$PASS" ]; then
Line 98  if [ -z "$PASS" ]; then
         echo "<censored>"; # to write newline on output          echo "<censored>"; # to write newline on output
 fi  fi
   
 echo 'Enter your message (only one line, max 420 chars, it is binary safe):';  #echo 'Enter your message (only one line, max 420 chars, it is binary safe):';
 IF= read text;  #IF= read text;
 text=`echo "$text" | sed 's/%/%25/g; s/\+/%2B/g; s/ /+/g; s/&/%26/g'`;  #text=`echo "$text" | sed 's/%/%25/g; s/\+/%2B/g; s/ /+/g; s/&/%26/g'`;
   echo 'Enter your message (max 420 chars, lines will be joined with space):';
   text=`cat` # text from stdin, multiple lines
   text="`echo \"$text\" \
           | awk 'BEGIN { ORS="+"} \
           { gsub(/%/, "%25"); \
                   gsub(/\+/, "%2B"); \
                   gsub(/ /, "+"); \
                   gsub(/\&/, "%26"); \
                   print; }'`"
   
   
 # download the file via special wget which stores session cookie to a file  # download the file via special wget which stores session cookie to a file
 # Cookies format:  # Cookies format:
Line 113  echo -n 'Checking number of free SMSs...
Line 126  echo -n 'Checking number of free SMSs...
 #       $WWW/u_profil.show_stat > $TMP_FILE1;  #       $WWW/u_profil.show_stat > $TMP_FILE1;
 #smss_sent=`grep '^<TD>[0-9]\+</TD>$' $TMP_FILE1 | head -n 1 | sed 's/<TD>\([0-9]\+\).*/\1/'`;  #smss_sent=`grep '^<TD>[0-9]\+</TD>$' $TMP_FILE1 | head -n 1 | sed 's/<TD>\([0-9]\+\).*/\1/'`;
 smss_sent=`GET -H "Cookie: SITY=$COOKIE" \  smss_sent=`GET -H "Cookie: SITY=$COOKIE" \
         $WWW/u_profil.show_stat | awk '/^<TD>[0-9]\+</TD>$/ { gsub(/[><]/, " "); print $2;  exit; } '`;          $WWW/u_profil.show_stat \
           | awk '/^<TD>[0-9]+<\/TD>$/ { gsub(/[><]/, " "); print $2;  exit; } '`;
   
 echo "100-$smss_sent" | bc;  echo "100-$smss_sent" | bc;
   
Line 140  if [ $smss_left ]; then
Line 154  if [ $smss_left ]; then
         rm -f $TMP_FILE1;          rm -f $TMP_FILE1;
         rm -f $TMP_FILE2;          rm -f $TMP_FILE2;
 else  else
         echo 'Something went wrong, see debug files ($TMP_FILE1, $TMP_FILE2).';          echo "Something went wrong, see debug files ($TMP_FILE1, $TMP_FILE2).";
 fi  fi
   

Legend:
Removed from v.1.14  
changed lines
  Added in v.1.15

Platon Group <platon@platon.org> http://platon.org/
Copyright © 2002-2006 Platon Group
Site powered by Metafox CMS
Go to Top