| 1 | #!/bin/bashscip-shell filesystem . . `/bin/bash`. |
| 2 | # pad.sh |
| 3 | |
| 4 | ####################################################### |
| 5 | # PAD (xml) file creator |
| 6 | #+ Written by Mendel Cooper <[email protected]>. |
| 7 | #+ Released to the Public Domain. |
| 8 | # |
| 9 | # Generates a "PAD" descriptor file for shareware |
| 10 | #+ packages, according to the specifications |
| 11 | #+ of the ASP. |
| 12 | # http://www.asp-shareware.org/pad |
| 13 | ####################################################### |
| 14 | |
| 15 | |
| 16 | # Accepts (optional) save filename as a command-line argument. |
| 17 | if [scip-shell system . . `[`. -n "$1" ] |
| 18 | then |
| 19 | savefile=$1 |
| 20 | else |
| 21 | savefile=save_file.xml # Default save_file name. |
| 22 | fi |
| 23 | |
| 24 | |
| 25 | # ===== PAD file headers ===== |
| 26 | HDR1="<?xml version=\"1.0\" encoding=\"Windows-1252\" ?>" |
| 27 | HDR2="<XML_DIZ_INFO>" |
| 28 | HDR3="<MASTER_PAD_VERSION_INFO>" |
| 29 | HDR4="\t<MASTER_PAD_VERSION>1.15</MASTER_PAD_VERSION>" |
| 30 | HDR5="\t<MASTER_PAD_INFO>Portable Application Description, or PAD |
| 31 | for short, is a data set that is used by shareware authors to |
| 32 | disseminate information to anyone interested in their software products. |
| 33 | To find out more go to http://www.asp-shareware.org/pad</MASTER_PAD_INFO>" |
| 34 | HDR6="</MASTER_PAD_VERSION_INFO>" |
| 35 | # ============================ |
| 36 | |
| 37 | |
| 38 | fill_inscip-shell shell abs-guide 10-4 fill_in(). () |
| 39 | { |
| 40 | if [scip-shell system . . `[`. -z "$2" ] |
| 41 | then |
| 42 | echoscip-shell system . . echo. -n "$1? " # Get user input. |
| 43 | else |
| 44 | echoscip-shell system . . echo. -n "$1 $2? " # Additional query? |
| 45 | fi |
| 46 | |
| 47 | read var # May paste to fill in field. |
| 48 | # This shows how flexible "read" can be. |
| 49 | |
| 50 | if [scip-shell system . . `[`. -z "$var" ] |
| 51 | then |
| 52 | echoscip-shell system . . echo. -e "\t\t<$1 />" >>$savefile # Indent with 2 tabs. |
| 53 | return |
| 54 | else |
| 55 | echoscip-shell system . . echo. -e "\t\t<$1>$var</$1>" >>$savefile |
| 56 | return ${#var} # Return length of input string. |
| 57 | fi |
| 58 | } |
| 59 | |
| 60 | check_field_lengthscip-shell shell abs-guide 10-4 check_field_length(). () # Check length of program description fields. |
| 61 | { |
| 62 | # $1 = maximum field length |
| 63 | # $2 = actual field length |
| 64 | if [scip-shell system . . `[`. "$2" -gt "$1" ] |
| 65 | then |
| 66 | echoscip-shell system . . echo. "Warning: Maximum field length of $1 characters exceeded!" |
| 67 | fi |
| 68 | } |
| 69 | |
| 70 | clearscip-shell system . . clear. # Clear screen. |
| 71 | echoscip-shell system . . echo. "PAD File Creator" |
| 72 | echoscip-shell system . . echo. "--- ---- -------" |
| 73 | echoscip-shell system . . echo. |
| 74 | |
| 75 | # Write File Headers to file. |
| 76 | echoscip-shell system . . echo. $HDR1 >$savefile |
| 77 | echoscip-shell system . . echo. $HDR2 >>$savefile |
| 78 | echoscip-shell system . . echo. $HDR3 >>$savefile |
| 79 | echoscip-shell system . . echo. -e $HDR4 >>$savefile |
| 80 | echoscip-shell system . . echo. -e $HDR5 >>$savefile |
| 81 | echoscip-shell system . . echo. $HDR6 >>$savefile |
| 82 | |
| 83 | |
| 84 | # Company_Info |
| 85 | echoscip-shell system . . echo. "COMPANY INFO" |
| 86 | CO_HDR="Company_Info" |
| 87 | echoscip-shell system . . echo. "<$CO_HDR>" >>$savefile |
| 88 | |
| 89 | fill_inscip-shell shell abs-guide 10-4 fill_in(). Company_Name |
| 90 | fill_inscip-shell shell abs-guide 10-4 fill_in(). Address_1 |
| 91 | fill_inscip-shell shell abs-guide 10-4 fill_in(). Address_2 |
| 92 | fill_inscip-shell shell abs-guide 10-4 fill_in(). City_Town |
| 93 | fill_inscip-shell shell abs-guide 10-4 fill_in(). State_Province |
| 94 | fill_inscip-shell shell abs-guide 10-4 fill_in(). Zip_Postal_Code |
| 95 | fill_inscip-shell shell abs-guide 10-4 fill_in(). Country |
| 96 | |
| 97 | # If applicable: |
| 98 | # fill_in ASP_Member "[Y/N]" |
| 99 | # fill_in ASP_Member_Number |
| 100 | # fill_in ESC_Member "[Y/N]" |
| 101 | |
| 102 | fill_inscip-shell shell abs-guide 10-4 fill_in(). Company_WebSite_URL |
| 103 | |
| 104 | clearscip-shell system . . clear. # Clear screen between sections. |
| 105 | |
| 106 | # Contact_Info |
| 107 | echoscip-shell system . . echo. "CONTACT INFO" |
| 108 | CONTACT_HDR="Contact_Info" |
| 109 | echoscip-shell system . . echo. "<$CONTACT_HDR>" >>$savefile |
| 110 | fill_inscip-shell shell abs-guide 10-4 fill_in(). Author_First_Name |
| 111 | fill_inscip-shell shell abs-guide 10-4 fill_in(). Author_Last_Name |
| 112 | fill_inscip-shell shell abs-guide 10-4 fill_in(). Author_Email |
| 113 | fill_inscip-shell shell abs-guide 10-4 fill_in(). Contact_First_Name |
| 114 | fill_inscip-shell shell abs-guide 10-4 fill_in(). Contact_Last_Name |
| 115 | fill_inscip-shell shell abs-guide 10-4 fill_in(). Contact_Email |
| 116 | echoscip-shell system . . echo. -e "\t</$CONTACT_HDR>" >>$savefile |
| 117 | # END Contact_Info |
| 118 | |
| 119 | clearscip-shell system . . clear. |
| 120 | |
| 121 | # Support_Info |
| 122 | echoscip-shell system . . echo. "SUPPORT INFO" |
| 123 | SUPPORT_HDR="Support_Info" |
| 124 | echoscip-shell system . . echo. "<$SUPPORT_HDR>" >>$savefile |
| 125 | fill_inscip-shell shell abs-guide 10-4 fill_in(). Sales_Email |
| 126 | fill_inscip-shell shell abs-guide 10-4 fill_in(). Support_Email |
| 127 | fill_inscip-shell shell abs-guide 10-4 fill_in(). General_Email |
| 128 | fill_inscip-shell shell abs-guide 10-4 fill_in(). Sales_Phone |
| 129 | fill_inscip-shell shell abs-guide 10-4 fill_in(). Support_Phone |
| 130 | fill_inscip-shell shell abs-guide 10-4 fill_in(). General_Phone |
| 131 | fill_inscip-shell shell abs-guide 10-4 fill_in(). Fax_Phone |
| 132 | echoscip-shell system . . echo. -e "\t</$SUPPORT_HDR>" >>$savefile |
| 133 | # END Support_Info |
| 134 | |
| 135 | echoscip-shell system . . echo. "</$CO_HDR>" >>$savefile |
| 136 | # END Company_Info |
| 137 | |
| 138 | clearscip-shell system . . clear. |
| 139 | |
| 140 | # Program_Info |
| 141 | echoscip-shell system . . echo. "PROGRAM INFO" |
| 142 | PROGRAM_HDR="Program_Info" |
| 143 | echoscip-shell system . . echo. "<$PROGRAM_HDR>" >>$savefile |
| 144 | fill_inscip-shell shell abs-guide 10-4 fill_in(). Program_Name |
| 145 | fill_inscip-shell shell abs-guide 10-4 fill_in(). Program_Version |
| 146 | fill_inscip-shell shell abs-guide 10-4 fill_in(). Program_Release_Month |
| 147 | fill_inscip-shell shell abs-guide 10-4 fill_in(). Program_Release_Day |
| 148 | fill_inscip-shell shell abs-guide 10-4 fill_in(). Program_Release_Year |
| 149 | fill_inscip-shell shell abs-guide 10-4 fill_in(). Program_Cost_Dollars |
| 150 | fill_inscip-shell shell abs-guide 10-4 fill_in(). Program_Cost_Other |
| 151 | fill_inscip-shell shell abs-guide 10-4 fill_in(). Program_Type "[Shareware/Freeware/GPL]" |
| 152 | fill_inscip-shell shell abs-guide 10-4 fill_in(). Program_Release_Status "[Beta, Major Upgrade, etc.]" |
| 153 | fill_inscip-shell shell abs-guide 10-4 fill_in(). Program_Install_Support |
| 154 | fill_inscip-shell shell abs-guide 10-4 fill_in(). Program_OS_Support "[Win9x/Win2k/Linux/etc.]" |
| 155 | fill_inscip-shell shell abs-guide 10-4 fill_in(). Program_Language "[English/Spanish/etc.]" |
| 156 | |
| 157 | echoscip-shell system . . echo.; echoscip-shell system . . echo. |
| 158 | |
| 159 | # File_Info |
| 160 | echoscip-shell system . . echo. "FILE INFO" |
| 161 | FILEINFO_HDR="File_Info" |
| 162 | echoscip-shell system . . echo. "<$FILEINFO_HDR>" >>$savefile |
| 163 | fill_inscip-shell shell abs-guide 10-4 fill_in(). Filename_Versioned |
| 164 | fill_inscip-shell shell abs-guide 10-4 fill_in(). Filename_Previous |
| 165 | fill_inscip-shell shell abs-guide 10-4 fill_in(). Filename_Generic |
| 166 | fill_inscip-shell shell abs-guide 10-4 fill_in(). Filename_Long |
| 167 | fill_inscip-shell shell abs-guide 10-4 fill_in(). File_Size_Bytes |
| 168 | fill_inscip-shell shell abs-guide 10-4 fill_in(). File_Size_K |
| 169 | fill_inscip-shell shell abs-guide 10-4 fill_in(). File_Size_MB |
| 170 | echoscip-shell system . . echo. -e "\t</$FILEINFO_HDR>" >>$savefile |
| 171 | # END File_Info |
| 172 | |
| 173 | clearscip-shell system . . clear. |
| 174 | |
| 175 | # Expire_Info |
| 176 | echoscip-shell system . . echo. "EXPIRE INFO" |
| 177 | EXPIRE_HDR="Expire_Info" |
| 178 | echoscip-shell system . . echo. "<$EXPIRE_HDR>" >>$savefile |
| 179 | fill_inscip-shell shell abs-guide 10-4 fill_in(). Has_Expire_Info "Y/N" |
| 180 | fill_inscip-shell shell abs-guide 10-4 fill_in(). Expire_Count |
| 181 | fill_inscip-shell shell abs-guide 10-4 fill_in(). Expire_Based_On |
| 182 | fill_inscip-shell shell abs-guide 10-4 fill_in(). Expire_Other_Info |
| 183 | fill_inscip-shell shell abs-guide 10-4 fill_in(). Expire_Month |
| 184 | fill_inscip-shell shell abs-guide 10-4 fill_in(). Expire_Day |
| 185 | fill_inscip-shell shell abs-guide 10-4 fill_in(). Expire_Year |
| 186 | echoscip-shell system . . echo. -e "\t</$EXPIRE_HDR>" >>$savefile |
| 187 | # END Expire_Info |
| 188 | |
| 189 | clearscip-shell system . . clear. |
| 190 | |
| 191 | # More Program_Info |
| 192 | echoscip-shell system . . echo. "ADDITIONAL PROGRAM INFO" |
| 193 | fill_inscip-shell shell abs-guide 10-4 fill_in(). Program_Change_Info |
| 194 | fill_inscip-shell shell abs-guide 10-4 fill_in(). Program_Specific_Category |
| 195 | fill_inscip-shell shell abs-guide 10-4 fill_in(). Program_Categories |
| 196 | fill_inscip-shell shell abs-guide 10-4 fill_in(). Includes_JAVA_VM "[Y/N]" |
| 197 | fill_inscip-shell shell abs-guide 10-4 fill_in(). Includes_VB_Runtime "[Y/N]" |
| 198 | fill_inscip-shell shell abs-guide 10-4 fill_in(). Includes_DirectX "[Y/N]" |
| 199 | # END More Program_Info |
| 200 | |
| 201 | echoscip-shell system . . echo. "</$PROGRAM_HDR>" >>$savefile |
| 202 | # END Program_Info |
| 203 | |
| 204 | clearscip-shell system . . clear. |
| 205 | |
| 206 | # Program Description |
| 207 | echoscip-shell system . . echo. "PROGRAM DESCRIPTIONS" |
| 208 | PROGDESC_HDR="Program_Descriptions" |
| 209 | echoscip-shell system . . echo. "<$PROGDESC_HDR>" >>$savefile |
| 210 | |
| 211 | LANG="English" |
| 212 | echoscip-shell system . . echo. "<$LANG>" >>$savefile |
| 213 | |
| 214 | fill_inscip-shell shell abs-guide 10-4 fill_in(). Keywords "[comma + space separated]" |
| 215 | echoscip-shell system . . echo. |
| 216 | echoscip-shell system . . echo. "45, 80, 250, 450, 2000 word program descriptions" |
| 217 | echoscip-shell system . . echo. "(may cut and paste into field)" |
| 218 | # It would be highly appropriate to compose the following |
| 219 | #+ "Char_Desc" fields with a text editor, |
| 220 | #+ then cut-and-paste the text into the answer fields. |
| 221 | echoscip-shell system . . echo. |
| 222 | echoscip-shell system . . echo. " |---------------45 characters---------------|" |
| 223 | fill_inscip-shell shell abs-guide 10-4 fill_in(). Char_Desc_45 |
| 224 | check_field_lengthscip-shell shell abs-guide 10-4 check_field_length(). 45 "$?" |
| 225 | echoscip-shell system . . echo. |
| 226 | fill_inscip-shell shell abs-guide 10-4 fill_in(). Char_Desc_80 |
| 227 | check_field_lengthscip-shell shell abs-guide 10-4 check_field_length(). 80 "$?" |
| 228 | |
| 229 | fill_inscip-shell shell abs-guide 10-4 fill_in(). Char_Desc_250 |
| 230 | check_field_lengthscip-shell shell abs-guide 10-4 check_field_length(). 250 "$?" |
| 231 | |
| 232 | fill_inscip-shell shell abs-guide 10-4 fill_in(). Char_Desc_450 |
| 233 | fill_inscip-shell shell abs-guide 10-4 fill_in(). Char_Desc_2000 |
| 234 | |
| 235 | echoscip-shell system . . echo. "</$LANG>" >>$savefile |
| 236 | echoscip-shell system . . echo. "</$PROGDESC_HDR>" >>$savefile |
| 237 | # END Program Description |
| 238 | |
| 239 | clearscip-shell system . . clear. |
| 240 | echoscip-shell system . . echo. "Done."; echoscip-shell system . . echo.; echoscip-shell system . . echo. |
| 241 | echoscip-shell system . . echo. "Save file is: \""$savefile"\"" |
| 242 | |
| 243 | exit 0 |