"Fossies" - the Fresh Open Source Software Archive

Member "gcal-4.1/misc/gcalltx/gcalltx" (22 Jan 2017, 3070 Bytes) of package /linux/misc/gcal-4.1.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Bash source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "gcalltx": 4_vs_4.1.

    1 #!/bin/sh
    2 #
    3 # @configure.input@
    4 #
    5 # gcalltx.in -- (C) Claus-Peter R"uckemann, 1996, 1998, 1999
    6 #
    7 # version 1.5
    8 #
    9 # This file may be distributed with Gcal under the terms
   10 # of the GNU public license.
   11 #
   12 # This script calls gcalltx.sed to convert 'gcal -n -u %0001 year' output to
   13 # LaTeX tabular output.
   14 #
   15 # UN*X solution.
   16 #
   17 packagedatamiscdir=.
   18 #
   19 PACKAGE=gcal
   20 VERSION=4.1
   21 transform=s,x,x,
   22 #
   23 INSTALL_DATA="${INSTALL} -m 644"
   24 #
   25 Rm=rm
   26 Sed=sed
   27 Echo=echo
   28 Test=test
   29 Chmod=chmod
   30 #
   31 mydefaultname=gcalltx
   32 #
   33 myname=`$Echo "$0" | $Sed -e 's,.*/,,' -e "$transform"`
   34 #
   35 ThisGcal=../../src/gcal
   36 #
   37 Sed_script_in=$packagedatamiscdir/$mydefaultname"".sed
   38 Sed_script_out=$packagedatamiscdir/$mydefaultname"".cpr
   39 #
   40 SRCPERMS=`$Echo "$INSTALL_DATA" | $Sed -e 's,^.*/,,' -e 's/[^0-9]//g'`
   41 SRCPERMS2=0644
   42 #
   43 trap "$Rm -f gcaltmp* $mydefaultname"".tex;exit 2" 1 2 15
   44 #
   45 case "$#" in
   46      1) GCAL= $ThisGcal -n -u %0001 --christian-holidays $* >gcaltmp
   47         ;;
   48      2) GCAL= $ThisGcal -n -u %0001 --cc-holidays=$* >gcaltmp
   49         ;;
   50      3) GCAL= $ThisGcal -n -u %0001 --christian-holidays --cc-holidays=$* >gcaltmp
   51         ;;
   52      *) $Echo "usage: $myname year";
   53         $Echo "       $myname country_code year";
   54         $Echo "       $myname country_code year --christian-holidays";
   55         $Echo "";
   56         $Echo "(1st usage provides only Christian holidays)";
   57         $Echo "(2nd usage provides country_code holidays)";
   58         $Echo "(3rd usage provides Christian and country_code holidays)";
   59         $Echo "";
   60         $Echo "country_codes is a country code or a list of country codes";
   61         $Echo "as supported by \`$ThisGcal'.";
   62         $Echo "";
   63         $Echo "Country codes are for example: BE ES FR";
   64         $Echo "";
   65         $Echo "A list of country codes can be created this way: BE+FR";
   66         $Echo "(s. $PACKAGE-$VERSION documentation)";
   67         exit 1;;
   68 esac
   69 
   70 if $Test "$?" -ne 0;
   71 then
   72   $Rm -f gcaltmp* $mydefaultname"".tex
   73   exit 2;
   74 fi
   75 
   76 # Added the two lines for 4-digits line numbers (BREAKPOINT & DEL)
   77 #
   78 $Sed "s/^/XYZ/g" gcaltmp >gcaltmp.tm1
   79 $Sed "=" gcaltmp.tm1 >gcaltmp.tm2
   80 # v--- breakpoint part
   81 $Echo "s/^\([5][0]\)/BREAKPOINT \1/g">gcaltmp.tm3
   82 $Echo "s/^\([0-9][50][0]\)/BREAKPOINT \1/g">>gcaltmp.tm3
   83 $Echo "s/^\([0-9][0-9][50][0]\)/BREAKPOINT \1/g">>gcaltmp.tm3
   84 $Echo "/^[0-9]/d">>gcaltmp.tm3
   85 $Echo "/^[0-9][0-9]/d">>gcaltmp.tm3
   86 $Echo "/^[0-9][0-9][0-9]/d">>gcaltmp.tm3
   87 $Echo "/^[0-9][0-9][0-9][0-9]/d">>gcaltmp.tm3
   88 $Echo "s/^XYZ//">>gcaltmp.tm3
   89 $Sed -f gcaltmp.tm3 gcaltmp.tm2 >gcaltmp
   90 # ^--- breakpoint part
   91 #
   92 if $Test ! -f "$Sed_script_out";
   93 then
   94   if $Test -f "$Sed_script_in";
   95   then
   96     $Sed -e '/^#.*[^\\]$/d' -e '/^#$/d' $Sed_script_in > $Sed_script_out
   97     if $Test -n "$SRCPERMS";
   98     then
   99       $Chmod $SRCPERMS $Sed_script_out
  100     else
  101       $Chmod $SRCPERMS2 $Sed_script_out
  102     fi
  103   else
  104     $Echo "$myname: error: file \`$Sed_script_in' is missing" 2>&1
  105     exit 2;
  106   fi
  107 fi
  108 
  109         $Sed -f $Sed_script_out gcaltmp >$mydefaultname"".tex
  110 
  111         $Rm -f gcaltmp*
  112 
  113 $Echo "$myname: Eternal holiday list written to file \`$mydefaultname"".tex'"
  114 ##EOF: