remind-rb 6.2.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (658) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +328 -0
  3. data/README.md +141 -0
  4. data/ext/remind/shim.c +379 -0
  5. data/lib/remind/builder.rb +252 -0
  6. data/lib/remind/library.rb +141 -0
  7. data/lib/remind/native.rb +257 -0
  8. data/lib/remind/reminder.rb +527 -0
  9. data/lib/remind/runtime.rb +130 -0
  10. data/lib/remind/session.rb +246 -0
  11. data/lib/remind/source.rb +160 -0
  12. data/lib/remind/value.rb +170 -0
  13. data/lib/remind/version.rb +13 -0
  14. data/lib/remind.rb +147 -0
  15. data/remind-v06.02.10/COPYRIGHT +300 -0
  16. data/remind-v06.02.10/configure +5684 -0
  17. data/remind-v06.02.10/configure.ac +131 -0
  18. data/remind-v06.02.10/docs/WHATSNEW +3858 -0
  19. data/remind-v06.02.10/include/ansitext.rem +35 -0
  20. data/remind-v06.02.10/include/holidays/ad/02.rem +15 -0
  21. data/remind-v06.02.10/include/holidays/ad/03.rem +14 -0
  22. data/remind-v06.02.10/include/holidays/ad/04.rem +14 -0
  23. data/remind-v06.02.10/include/holidays/ad/05.rem +14 -0
  24. data/remind-v06.02.10/include/holidays/ad/06.rem +16 -0
  25. data/remind-v06.02.10/include/holidays/ad/07.rem +15 -0
  26. data/remind-v06.02.10/include/holidays/ad/08.rem +14 -0
  27. data/remind-v06.02.10/include/holidays/ad.rem +28 -0
  28. data/remind-v06.02.10/include/holidays/ae.rem +10 -0
  29. data/remind-v06.02.10/include/holidays/al.rem +33 -0
  30. data/remind-v06.02.10/include/holidays/am.rem +19 -0
  31. data/remind-v06.02.10/include/holidays/ao.rem +41 -0
  32. data/remind-v06.02.10/include/holidays/ar.rem +38 -0
  33. data/remind-v06.02.10/include/holidays/as.rem +40 -0
  34. data/remind-v06.02.10/include/holidays/at/1.rem +15 -0
  35. data/remind-v06.02.10/include/holidays/at/2.rem +16 -0
  36. data/remind-v06.02.10/include/holidays/at/3.rem +15 -0
  37. data/remind-v06.02.10/include/holidays/at/4.rem +15 -0
  38. data/remind-v06.02.10/include/holidays/at/5.rem +15 -0
  39. data/remind-v06.02.10/include/holidays/at/6.rem +15 -0
  40. data/remind-v06.02.10/include/holidays/at/7.rem +15 -0
  41. data/remind-v06.02.10/include/holidays/at/8.rem +15 -0
  42. data/remind-v06.02.10/include/holidays/at/9.rem +15 -0
  43. data/remind-v06.02.10/include/holidays/at.rem +32 -0
  44. data/remind-v06.02.10/include/holidays/au/act.rem +27 -0
  45. data/remind-v06.02.10/include/holidays/au/nsw.rem +25 -0
  46. data/remind-v06.02.10/include/holidays/au/nt.rem +28 -0
  47. data/remind-v06.02.10/include/holidays/au/qld.rem +23 -0
  48. data/remind-v06.02.10/include/holidays/au/sa.rem +29 -0
  49. data/remind-v06.02.10/include/holidays/au/tas.rem +16 -0
  50. data/remind-v06.02.10/include/holidays/au/vic.rem +24 -0
  51. data/remind-v06.02.10/include/holidays/au/wa.rem +24 -0
  52. data/remind-v06.02.10/include/holidays/au.rem +21 -0
  53. data/remind-v06.02.10/include/holidays/aw.rem +19 -0
  54. data/remind-v06.02.10/include/holidays/az.rem +44 -0
  55. data/remind-v06.02.10/include/holidays/ba/bih.rem +23 -0
  56. data/remind-v06.02.10/include/holidays/ba/brc.rem +20 -0
  57. data/remind-v06.02.10/include/holidays/ba/srp.rem +23 -0
  58. data/remind-v06.02.10/include/holidays/ba.rem +22 -0
  59. data/remind-v06.02.10/include/holidays/bb.rem +28 -0
  60. data/remind-v06.02.10/include/holidays/bd.rem +14 -0
  61. data/remind-v06.02.10/include/holidays/be.rem +24 -0
  62. data/remind-v06.02.10/include/holidays/bf.rem +29 -0
  63. data/remind-v06.02.10/include/holidays/bg.rem +34 -0
  64. data/remind-v06.02.10/include/holidays/bh.rem +11 -0
  65. data/remind-v06.02.10/include/holidays/bi.rem +30 -0
  66. data/remind-v06.02.10/include/holidays/bn.rem +22 -0
  67. data/remind-v06.02.10/include/holidays/bo/b.rem +13 -0
  68. data/remind-v06.02.10/include/holidays/bo/c.rem +13 -0
  69. data/remind-v06.02.10/include/holidays/bo/h.rem +13 -0
  70. data/remind-v06.02.10/include/holidays/bo/l.rem +13 -0
  71. data/remind-v06.02.10/include/holidays/bo/n.rem +13 -0
  72. data/remind-v06.02.10/include/holidays/bo/o.rem +13 -0
  73. data/remind-v06.02.10/include/holidays/bo/p.rem +13 -0
  74. data/remind-v06.02.10/include/holidays/bo/s.rem +13 -0
  75. data/remind-v06.02.10/include/holidays/bo/t.rem +13 -0
  76. data/remind-v06.02.10/include/holidays/bo.rem +32 -0
  77. data/remind-v06.02.10/include/holidays/br/ac.rem +21 -0
  78. data/remind-v06.02.10/include/holidays/br/al.rem +16 -0
  79. data/remind-v06.02.10/include/holidays/br/am.rem +13 -0
  80. data/remind-v06.02.10/include/holidays/br/ap.rem +15 -0
  81. data/remind-v06.02.10/include/holidays/br/ba.rem +13 -0
  82. data/remind-v06.02.10/include/holidays/br/ce.rem +15 -0
  83. data/remind-v06.02.10/include/holidays/br/df.rem +14 -0
  84. data/remind-v06.02.10/include/holidays/br/es.rem +13 -0
  85. data/remind-v06.02.10/include/holidays/br/go.rem +14 -0
  86. data/remind-v06.02.10/include/holidays/br/ma.rem +13 -0
  87. data/remind-v06.02.10/include/holidays/br/mg.rem +13 -0
  88. data/remind-v06.02.10/include/holidays/br/ms.rem +13 -0
  89. data/remind-v06.02.10/include/holidays/br/pa.rem +13 -0
  90. data/remind-v06.02.10/include/holidays/br/pb.rem +13 -0
  91. data/remind-v06.02.10/include/holidays/br/pe.rem +13 -0
  92. data/remind-v06.02.10/include/holidays/br/pi.rem +13 -0
  93. data/remind-v06.02.10/include/holidays/br/pr.rem +13 -0
  94. data/remind-v06.02.10/include/holidays/br/rj.rem +13 -0
  95. data/remind-v06.02.10/include/holidays/br/rn.rem +14 -0
  96. data/remind-v06.02.10/include/holidays/br/ro.rem +14 -0
  97. data/remind-v06.02.10/include/holidays/br/rr.rem +13 -0
  98. data/remind-v06.02.10/include/holidays/br/rs.rem +13 -0
  99. data/remind-v06.02.10/include/holidays/br/sc.rem +14 -0
  100. data/remind-v06.02.10/include/holidays/br/se.rem +13 -0
  101. data/remind-v06.02.10/include/holidays/br/sp.rem +13 -0
  102. data/remind-v06.02.10/include/holidays/br/to.rem +15 -0
  103. data/remind-v06.02.10/include/holidays/br.rem +33 -0
  104. data/remind-v06.02.10/include/holidays/bs.rem +26 -0
  105. data/remind-v06.02.10/include/holidays/bw.rem +31 -0
  106. data/remind-v06.02.10/include/holidays/by.rem +17 -0
  107. data/remind-v06.02.10/include/holidays/bz.rem +43 -0
  108. data/remind-v06.02.10/include/holidays/ca/ab.rem +17 -0
  109. data/remind-v06.02.10/include/holidays/ca/bc.rem +14 -0
  110. data/remind-v06.02.10/include/holidays/ca/mb.rem +16 -0
  111. data/remind-v06.02.10/include/holidays/ca/nb.rem +14 -0
  112. data/remind-v06.02.10/include/holidays/ca/nl.rem +19 -0
  113. data/remind-v06.02.10/include/holidays/ca/ns.rem +16 -0
  114. data/remind-v06.02.10/include/holidays/ca/nt.rem +14 -0
  115. data/remind-v06.02.10/include/holidays/ca/nu.rem +16 -0
  116. data/remind-v06.02.10/include/holidays/ca/on.rem +16 -0
  117. data/remind-v06.02.10/include/holidays/ca/pe.rem +13 -0
  118. data/remind-v06.02.10/include/holidays/ca/qc.rem +18 -0
  119. data/remind-v06.02.10/include/holidays/ca/sk.rem +14 -0
  120. data/remind-v06.02.10/include/holidays/ca/yt.rem +17 -0
  121. data/remind-v06.02.10/include/holidays/ca.rem +37 -0
  122. data/remind-v06.02.10/include/holidays/cg.rem +17 -0
  123. data/remind-v06.02.10/include/holidays/ch/ag.rem +22 -0
  124. data/remind-v06.02.10/include/holidays/ch/ai.rem +20 -0
  125. data/remind-v06.02.10/include/holidays/ch/ar.rem +16 -0
  126. data/remind-v06.02.10/include/holidays/ch/be.rem +17 -0
  127. data/remind-v06.02.10/include/holidays/ch/bl.rem +17 -0
  128. data/remind-v06.02.10/include/holidays/ch/bs.rem +17 -0
  129. data/remind-v06.02.10/include/holidays/ch/fr.rem +19 -0
  130. data/remind-v06.02.10/include/holidays/ch/ge.rem +17 -0
  131. data/remind-v06.02.10/include/holidays/ch/gl.rem +22 -0
  132. data/remind-v06.02.10/include/holidays/ch/gr.rem +18 -0
  133. data/remind-v06.02.10/include/holidays/ch/ju.rem +21 -0
  134. data/remind-v06.02.10/include/holidays/ch/lu.rem +21 -0
  135. data/remind-v06.02.10/include/holidays/ch/ne.rem +18 -0
  136. data/remind-v06.02.10/include/holidays/ch/nw.rem +24 -0
  137. data/remind-v06.02.10/include/holidays/ch/ow.rem +24 -0
  138. data/remind-v06.02.10/include/holidays/ch/sg.rem +20 -0
  139. data/remind-v06.02.10/include/holidays/ch/sh.rem +20 -0
  140. data/remind-v06.02.10/include/holidays/ch/so.rem +17 -0
  141. data/remind-v06.02.10/include/holidays/ch/sz.rem +22 -0
  142. data/remind-v06.02.10/include/holidays/ch/tg.rem +18 -0
  143. data/remind-v06.02.10/include/holidays/ch/ti.rem +23 -0
  144. data/remind-v06.02.10/include/holidays/ch/ur.rem +22 -0
  145. data/remind-v06.02.10/include/holidays/ch/vd.rem +17 -0
  146. data/remind-v06.02.10/include/holidays/ch/vs.rem +23 -0
  147. data/remind-v06.02.10/include/holidays/ch/zg.rem +23 -0
  148. data/remind-v06.02.10/include/holidays/ch/zh.rem +18 -0
  149. data/remind-v06.02.10/include/holidays/ch.rem +18 -0
  150. data/remind-v06.02.10/include/holidays/chinese-new-year.rem +86 -0
  151. data/remind-v06.02.10/include/holidays/cl/ap.rem +13 -0
  152. data/remind-v06.02.10/include/holidays/cl/nb.rem +13 -0
  153. data/remind-v06.02.10/include/holidays/cl.rem +46 -0
  154. data/remind-v06.02.10/include/holidays/cm.rem +21 -0
  155. data/remind-v06.02.10/include/holidays/co.rem +85 -0
  156. data/remind-v06.02.10/include/holidays/cr.rem +39 -0
  157. data/remind-v06.02.10/include/holidays/cu.rem +19 -0
  158. data/remind-v06.02.10/include/holidays/cw.rem +24 -0
  159. data/remind-v06.02.10/include/holidays/cy.rem +27 -0
  160. data/remind-v06.02.10/include/holidays/cz.rem +20 -0
  161. data/remind-v06.02.10/include/holidays/de/bb.rem +15 -0
  162. data/remind-v06.02.10/include/holidays/de/be.rem +13 -0
  163. data/remind-v06.02.10/include/holidays/de/bw.rem +15 -0
  164. data/remind-v06.02.10/include/holidays/de/by.rem +18 -0
  165. data/remind-v06.02.10/include/holidays/de/hb.rem +13 -0
  166. data/remind-v06.02.10/include/holidays/de/he.rem +13 -0
  167. data/remind-v06.02.10/include/holidays/de/hh.rem +13 -0
  168. data/remind-v06.02.10/include/holidays/de/mv.rem +14 -0
  169. data/remind-v06.02.10/include/holidays/de/ni.rem +13 -0
  170. data/remind-v06.02.10/include/holidays/de/nw.rem +14 -0
  171. data/remind-v06.02.10/include/holidays/de/rp.rem +14 -0
  172. data/remind-v06.02.10/include/holidays/de/sh.rem +13 -0
  173. data/remind-v06.02.10/include/holidays/de/sl.rem +15 -0
  174. data/remind-v06.02.10/include/holidays/de/sn.rem +14 -0
  175. data/remind-v06.02.10/include/holidays/de/st.rem +14 -0
  176. data/remind-v06.02.10/include/holidays/de/th.rem +14 -0
  177. data/remind-v06.02.10/include/holidays/de.rem +23 -0
  178. data/remind-v06.02.10/include/holidays/discordian.rem +25 -0
  179. data/remind-v06.02.10/include/holidays/dj.rem +12 -0
  180. data/remind-v06.02.10/include/holidays/dk.rem +23 -0
  181. data/remind-v06.02.10/include/holidays/dm.rem +24 -0
  182. data/remind-v06.02.10/include/holidays/do.rem +36 -0
  183. data/remind-v06.02.10/include/holidays/dz.rem +12 -0
  184. data/remind-v06.02.10/include/holidays/ec.rem +48 -0
  185. data/remind-v06.02.10/include/holidays/ee.rem +19 -0
  186. data/remind-v06.02.10/include/holidays/eg.rem +17 -0
  187. data/remind-v06.02.10/include/holidays/es/an.rem +17 -0
  188. data/remind-v06.02.10/include/holidays/es/ar.rem +17 -0
  189. data/remind-v06.02.10/include/holidays/es/as.rem +17 -0
  190. data/remind-v06.02.10/include/holidays/es/cb.rem +15 -0
  191. data/remind-v06.02.10/include/holidays/es/ce.rem +15 -0
  192. data/remind-v06.02.10/include/holidays/es/cl.rem +17 -0
  193. data/remind-v06.02.10/include/holidays/es/cm.rem +15 -0
  194. data/remind-v06.02.10/include/holidays/es/cn.rem +15 -0
  195. data/remind-v06.02.10/include/holidays/es/ct.rem +16 -0
  196. data/remind-v06.02.10/include/holidays/es/ex.rem +16 -0
  197. data/remind-v06.02.10/include/holidays/es/ga.rem +15 -0
  198. data/remind-v06.02.10/include/holidays/es/ib.rem +15 -0
  199. data/remind-v06.02.10/include/holidays/es/mc.rem +17 -0
  200. data/remind-v06.02.10/include/holidays/es/md.rem +16 -0
  201. data/remind-v06.02.10/include/holidays/es/ml.rem +15 -0
  202. data/remind-v06.02.10/include/holidays/es/nc.rem +15 -0
  203. data/remind-v06.02.10/include/holidays/es/pv.rem +15 -0
  204. data/remind-v06.02.10/include/holidays/es/ri.rem +16 -0
  205. data/remind-v06.02.10/include/holidays/es/vc.rem +16 -0
  206. data/remind-v06.02.10/include/holidays/es.rem +23 -0
  207. data/remind-v06.02.10/include/holidays/et.rem +20 -0
  208. data/remind-v06.02.10/include/holidays/fi.rem +43 -0
  209. data/remind-v06.02.10/include/holidays/fr/bl.rem +13 -0
  210. data/remind-v06.02.10/include/holidays/fr/ges.rem +14 -0
  211. data/remind-v06.02.10/include/holidays/fr/gp.rem +16 -0
  212. data/remind-v06.02.10/include/holidays/fr/gy.rem +13 -0
  213. data/remind-v06.02.10/include/holidays/fr/mf.rem +13 -0
  214. data/remind-v06.02.10/include/holidays/fr/mq.rem +15 -0
  215. data/remind-v06.02.10/include/holidays/fr/nc.rem +13 -0
  216. data/remind-v06.02.10/include/holidays/fr/pf.rem +15 -0
  217. data/remind-v06.02.10/include/holidays/fr/re.rem +13 -0
  218. data/remind-v06.02.10/include/holidays/fr/wf.rem +14 -0
  219. data/remind-v06.02.10/include/holidays/fr/yt.rem +13 -0
  220. data/remind-v06.02.10/include/holidays/fr.rem +18 -0
  221. data/remind-v06.02.10/include/holidays/ga.rem +18 -0
  222. data/remind-v06.02.10/include/holidays/gb/eng.rem +14 -0
  223. data/remind-v06.02.10/include/holidays/gb/nir.rem +20 -0
  224. data/remind-v06.02.10/include/holidays/gb/sct.rem +20 -0
  225. data/remind-v06.02.10/include/holidays/gb/wls.rem +14 -0
  226. data/remind-v06.02.10/include/holidays/gb.rem +27 -0
  227. data/remind-v06.02.10/include/holidays/ge.rem +24 -0
  228. data/remind-v06.02.10/include/holidays/gh.rem +34 -0
  229. data/remind-v06.02.10/include/holidays/gl.rem +25 -0
  230. data/remind-v06.02.10/include/holidays/gr.rem +37 -0
  231. data/remind-v06.02.10/include/holidays/gt.rem +24 -0
  232. data/remind-v06.02.10/include/holidays/gu.rem +37 -0
  233. data/remind-v06.02.10/include/holidays/hk.rem +25 -0
  234. data/remind-v06.02.10/include/holidays/hn.rem +18 -0
  235. data/remind-v06.02.10/include/holidays/hr.rem +21 -0
  236. data/remind-v06.02.10/include/holidays/ht.rem +34 -0
  237. data/remind-v06.02.10/include/holidays/hu.rem +20 -0
  238. data/remind-v06.02.10/include/holidays/id.rem +15 -0
  239. data/remind-v06.02.10/include/holidays/ie.rem +41 -0
  240. data/remind-v06.02.10/include/holidays/im.rem +26 -0
  241. data/remind-v06.02.10/include/holidays/in/ap.rem +14 -0
  242. data/remind-v06.02.10/include/holidays/in/as.rem +13 -0
  243. data/remind-v06.02.10/include/holidays/in/br.rem +14 -0
  244. data/remind-v06.02.10/include/holidays/in/cg.rem +13 -0
  245. data/remind-v06.02.10/include/holidays/in/gj.rem +15 -0
  246. data/remind-v06.02.10/include/holidays/in/hr.rem +14 -0
  247. data/remind-v06.02.10/include/holidays/in/ka.rem +13 -0
  248. data/remind-v06.02.10/include/holidays/in/kl.rem +14 -0
  249. data/remind-v06.02.10/include/holidays/in/mh.rem +15 -0
  250. data/remind-v06.02.10/include/holidays/in/mp.rem +13 -0
  251. data/remind-v06.02.10/include/holidays/in/od.rem +15 -0
  252. data/remind-v06.02.10/include/holidays/in/rj.rem +14 -0
  253. data/remind-v06.02.10/include/holidays/in/sk.rem +13 -0
  254. data/remind-v06.02.10/include/holidays/in/tn.rem +15 -0
  255. data/remind-v06.02.10/include/holidays/in/ts.rem +14 -0
  256. data/remind-v06.02.10/include/holidays/in/uk.rem +13 -0
  257. data/remind-v06.02.10/include/holidays/in/up.rem +13 -0
  258. data/remind-v06.02.10/include/holidays/in/wb.rem +16 -0
  259. data/remind-v06.02.10/include/holidays/in.rem +24 -0
  260. data/remind-v06.02.10/include/holidays/is.rem +23 -0
  261. data/remind-v06.02.10/include/holidays/it/ag.rem +13 -0
  262. data/remind-v06.02.10/include/holidays/it/al.rem +13 -0
  263. data/remind-v06.02.10/include/holidays/it/an.rem +13 -0
  264. data/remind-v06.02.10/include/holidays/it/andria.rem +13 -0
  265. data/remind-v06.02.10/include/holidays/it/ao.rem +13 -0
  266. data/remind-v06.02.10/include/holidays/it/ap.rem +13 -0
  267. data/remind-v06.02.10/include/holidays/it/aq.rem +13 -0
  268. data/remind-v06.02.10/include/holidays/it/ar.rem +13 -0
  269. data/remind-v06.02.10/include/holidays/it/at.rem +13 -0
  270. data/remind-v06.02.10/include/holidays/it/av.rem +13 -0
  271. data/remind-v06.02.10/include/holidays/it/ba.rem +13 -0
  272. data/remind-v06.02.10/include/holidays/it/barletta.rem +13 -0
  273. data/remind-v06.02.10/include/holidays/it/bg.rem +13 -0
  274. data/remind-v06.02.10/include/holidays/it/bl.rem +13 -0
  275. data/remind-v06.02.10/include/holidays/it/bn.rem +13 -0
  276. data/remind-v06.02.10/include/holidays/it/bo.rem +13 -0
  277. data/remind-v06.02.10/include/holidays/it/br.rem +13 -0
  278. data/remind-v06.02.10/include/holidays/it/bs.rem +13 -0
  279. data/remind-v06.02.10/include/holidays/it/bt.rem +15 -0
  280. data/remind-v06.02.10/include/holidays/it/bz.rem +14 -0
  281. data/remind-v06.02.10/include/holidays/it/ca.rem +13 -0
  282. data/remind-v06.02.10/include/holidays/it/cb.rem +13 -0
  283. data/remind-v06.02.10/include/holidays/it/ce.rem +13 -0
  284. data/remind-v06.02.10/include/holidays/it/cesena.rem +13 -0
  285. data/remind-v06.02.10/include/holidays/it/ch.rem +13 -0
  286. data/remind-v06.02.10/include/holidays/it/cl.rem +13 -0
  287. data/remind-v06.02.10/include/holidays/it/cn.rem +13 -0
  288. data/remind-v06.02.10/include/holidays/it/co.rem +13 -0
  289. data/remind-v06.02.10/include/holidays/it/cr.rem +13 -0
  290. data/remind-v06.02.10/include/holidays/it/cs.rem +13 -0
  291. data/remind-v06.02.10/include/holidays/it/ct.rem +13 -0
  292. data/remind-v06.02.10/include/holidays/it/cz.rem +13 -0
  293. data/remind-v06.02.10/include/holidays/it/en.rem +13 -0
  294. data/remind-v06.02.10/include/holidays/it/fc.rem +14 -0
  295. data/remind-v06.02.10/include/holidays/it/fe.rem +13 -0
  296. data/remind-v06.02.10/include/holidays/it/fg.rem +13 -0
  297. data/remind-v06.02.10/include/holidays/it/fi.rem +13 -0
  298. data/remind-v06.02.10/include/holidays/it/fm.rem +14 -0
  299. data/remind-v06.02.10/include/holidays/it/forli.rem +13 -0
  300. data/remind-v06.02.10/include/holidays/it/fr.rem +13 -0
  301. data/remind-v06.02.10/include/holidays/it/ge.rem +13 -0
  302. data/remind-v06.02.10/include/holidays/it/go.rem +13 -0
  303. data/remind-v06.02.10/include/holidays/it/gr.rem +13 -0
  304. data/remind-v06.02.10/include/holidays/it/im.rem +13 -0
  305. data/remind-v06.02.10/include/holidays/it/is.rem +13 -0
  306. data/remind-v06.02.10/include/holidays/it/kr.rem +13 -0
  307. data/remind-v06.02.10/include/holidays/it/lc.rem +13 -0
  308. data/remind-v06.02.10/include/holidays/it/le.rem +13 -0
  309. data/remind-v06.02.10/include/holidays/it/li.rem +13 -0
  310. data/remind-v06.02.10/include/holidays/it/lo.rem +13 -0
  311. data/remind-v06.02.10/include/holidays/it/lt.rem +14 -0
  312. data/remind-v06.02.10/include/holidays/it/lu.rem +13 -0
  313. data/remind-v06.02.10/include/holidays/it/mb.rem +13 -0
  314. data/remind-v06.02.10/include/holidays/it/mc.rem +13 -0
  315. data/remind-v06.02.10/include/holidays/it/me.rem +13 -0
  316. data/remind-v06.02.10/include/holidays/it/mi.rem +13 -0
  317. data/remind-v06.02.10/include/holidays/it/mn.rem +13 -0
  318. data/remind-v06.02.10/include/holidays/it/mo.rem +13 -0
  319. data/remind-v06.02.10/include/holidays/it/ms.rem +13 -0
  320. data/remind-v06.02.10/include/holidays/it/mt.rem +13 -0
  321. data/remind-v06.02.10/include/holidays/it/na.rem +13 -0
  322. data/remind-v06.02.10/include/holidays/it/no.rem +13 -0
  323. data/remind-v06.02.10/include/holidays/it/nu.rem +13 -0
  324. data/remind-v06.02.10/include/holidays/it/or.rem +13 -0
  325. data/remind-v06.02.10/include/holidays/it/pa.rem +13 -0
  326. data/remind-v06.02.10/include/holidays/it/pc.rem +13 -0
  327. data/remind-v06.02.10/include/holidays/it/pd.rem +13 -0
  328. data/remind-v06.02.10/include/holidays/it/pe.rem +13 -0
  329. data/remind-v06.02.10/include/holidays/it/pesaro.rem +13 -0
  330. data/remind-v06.02.10/include/holidays/it/pg.rem +14 -0
  331. data/remind-v06.02.10/include/holidays/it/pi.rem +13 -0
  332. data/remind-v06.02.10/include/holidays/it/pn.rem +14 -0
  333. data/remind-v06.02.10/include/holidays/it/pr.rem +13 -0
  334. data/remind-v06.02.10/include/holidays/it/pt.rem +13 -0
  335. data/remind-v06.02.10/include/holidays/it/pu.rem +14 -0
  336. data/remind-v06.02.10/include/holidays/it/pv.rem +13 -0
  337. data/remind-v06.02.10/include/holidays/it/pz.rem +13 -0
  338. data/remind-v06.02.10/include/holidays/it/ra.rem +13 -0
  339. data/remind-v06.02.10/include/holidays/it/rc.rem +13 -0
  340. data/remind-v06.02.10/include/holidays/it/re.rem +13 -0
  341. data/remind-v06.02.10/include/holidays/it/rg.rem +14 -0
  342. data/remind-v06.02.10/include/holidays/it/ri.rem +13 -0
  343. data/remind-v06.02.10/include/holidays/it/rm.rem +13 -0
  344. data/remind-v06.02.10/include/holidays/it/rn.rem +13 -0
  345. data/remind-v06.02.10/include/holidays/it/ro.rem +13 -0
  346. data/remind-v06.02.10/include/holidays/it/sa.rem +13 -0
  347. data/remind-v06.02.10/include/holidays/it/si.rem +13 -0
  348. data/remind-v06.02.10/include/holidays/it/so.rem +13 -0
  349. data/remind-v06.02.10/include/holidays/it/sp.rem +13 -0
  350. data/remind-v06.02.10/include/holidays/it/sr.rem +13 -0
  351. data/remind-v06.02.10/include/holidays/it/ss.rem +13 -0
  352. data/remind-v06.02.10/include/holidays/it/su.rem +13 -0
  353. data/remind-v06.02.10/include/holidays/it/sv.rem +13 -0
  354. data/remind-v06.02.10/include/holidays/it/ta.rem +13 -0
  355. data/remind-v06.02.10/include/holidays/it/te.rem +13 -0
  356. data/remind-v06.02.10/include/holidays/it/tn.rem +13 -0
  357. data/remind-v06.02.10/include/holidays/it/to.rem +13 -0
  358. data/remind-v06.02.10/include/holidays/it/tp.rem +13 -0
  359. data/remind-v06.02.10/include/holidays/it/tr.rem +13 -0
  360. data/remind-v06.02.10/include/holidays/it/trani.rem +13 -0
  361. data/remind-v06.02.10/include/holidays/it/ts.rem +13 -0
  362. data/remind-v06.02.10/include/holidays/it/tv.rem +13 -0
  363. data/remind-v06.02.10/include/holidays/it/ud.rem +13 -0
  364. data/remind-v06.02.10/include/holidays/it/urbino.rem +13 -0
  365. data/remind-v06.02.10/include/holidays/it/va.rem +13 -0
  366. data/remind-v06.02.10/include/holidays/it/vb.rem +13 -0
  367. data/remind-v06.02.10/include/holidays/it/vc.rem +13 -0
  368. data/remind-v06.02.10/include/holidays/it/ve.rem +14 -0
  369. data/remind-v06.02.10/include/holidays/it/vi.rem +13 -0
  370. data/remind-v06.02.10/include/holidays/it/vr.rem +13 -0
  371. data/remind-v06.02.10/include/holidays/it/vt.rem +13 -0
  372. data/remind-v06.02.10/include/holidays/it/vv.rem +13 -0
  373. data/remind-v06.02.10/include/holidays/it.rem +26 -0
  374. data/remind-v06.02.10/include/holidays/je.rem +19 -0
  375. data/remind-v06.02.10/include/holidays/jewish.rem +135 -0
  376. data/remind-v06.02.10/include/holidays/jm.rem +24 -0
  377. data/remind-v06.02.10/include/holidays/jo.rem +11 -0
  378. data/remind-v06.02.10/include/holidays/jp.rem +27 -0
  379. data/remind-v06.02.10/include/holidays/ke.rem +25 -0
  380. data/remind-v06.02.10/include/holidays/kg.rem +20 -0
  381. data/remind-v06.02.10/include/holidays/kh.rem +22 -0
  382. data/remind-v06.02.10/include/holidays/kn.rem +28 -0
  383. data/remind-v06.02.10/include/holidays/kr.rem +19 -0
  384. data/remind-v06.02.10/include/holidays/kw.rem +10 -0
  385. data/remind-v06.02.10/include/holidays/kz.rem +34 -0
  386. data/remind-v06.02.10/include/holidays/la.rem +47 -0
  387. data/remind-v06.02.10/include/holidays/lgbtq/au.rem +8 -0
  388. data/remind-v06.02.10/include/holidays/lgbtq/br.rem +10 -0
  389. data/remind-v06.02.10/include/holidays/lgbtq/ca.rem +7 -0
  390. data/remind-v06.02.10/include/holidays/lgbtq/cl.rem +7 -0
  391. data/remind-v06.02.10/include/holidays/lgbtq/ie.rem +7 -0
  392. data/remind-v06.02.10/include/holidays/lgbtq/in.rem +7 -0
  393. data/remind-v06.02.10/include/holidays/lgbtq/nl.rem +7 -0
  394. data/remind-v06.02.10/include/holidays/lgbtq/ua.rem +7 -0
  395. data/remind-v06.02.10/include/holidays/lgbtq/uk.rem +8 -0
  396. data/remind-v06.02.10/include/holidays/lgbtq/us.rem +16 -0
  397. data/remind-v06.02.10/include/holidays/lgbtq.rem +34 -0
  398. data/remind-v06.02.10/include/holidays/li.rem +31 -0
  399. data/remind-v06.02.10/include/holidays/ls.rem +18 -0
  400. data/remind-v06.02.10/include/holidays/lt.rem +23 -0
  401. data/remind-v06.02.10/include/holidays/lu.rem +18 -0
  402. data/remind-v06.02.10/include/holidays/lv.rem +25 -0
  403. data/remind-v06.02.10/include/holidays/ma.rem +17 -0
  404. data/remind-v06.02.10/include/holidays/mc.rem +26 -0
  405. data/remind-v06.02.10/include/holidays/md.rem +21 -0
  406. data/remind-v06.02.10/include/holidays/me.rem +28 -0
  407. data/remind-v06.02.10/include/holidays/mg.rem +24 -0
  408. data/remind-v06.02.10/include/holidays/mh.rem +22 -0
  409. data/remind-v06.02.10/include/holidays/misc.rem +9 -0
  410. data/remind-v06.02.10/include/holidays/mk.rem +17 -0
  411. data/remind-v06.02.10/include/holidays/mp.rem +44 -0
  412. data/remind-v06.02.10/include/holidays/mr.rem +11 -0
  413. data/remind-v06.02.10/include/holidays/mt.rem +21 -0
  414. data/remind-v06.02.10/include/holidays/mv.rem +12 -0
  415. data/remind-v06.02.10/include/holidays/mw.rem +36 -0
  416. data/remind-v06.02.10/include/holidays/mx.rem +15 -0
  417. data/remind-v06.02.10/include/holidays/my/01.rem +13 -0
  418. data/remind-v06.02.10/include/holidays/my/02.rem +13 -0
  419. data/remind-v06.02.10/include/holidays/my/03.rem +14 -0
  420. data/remind-v06.02.10/include/holidays/my/04.rem +18 -0
  421. data/remind-v06.02.10/include/holidays/my/05.rem +16 -0
  422. data/remind-v06.02.10/include/holidays/my/06.rem +17 -0
  423. data/remind-v06.02.10/include/holidays/my/07.rem +17 -0
  424. data/remind-v06.02.10/include/holidays/my/08.rem +15 -0
  425. data/remind-v06.02.10/include/holidays/my/09.rem +14 -0
  426. data/remind-v06.02.10/include/holidays/my/10.rem +16 -0
  427. data/remind-v06.02.10/include/holidays/my/11.rem +16 -0
  428. data/remind-v06.02.10/include/holidays/my/12.rem +19 -0
  429. data/remind-v06.02.10/include/holidays/my/13.rem +22 -0
  430. data/remind-v06.02.10/include/holidays/my/14.rem +16 -0
  431. data/remind-v06.02.10/include/holidays/my/15.rem +18 -0
  432. data/remind-v06.02.10/include/holidays/my/16.rem +16 -0
  433. data/remind-v06.02.10/include/holidays/my.rem +23 -0
  434. data/remind-v06.02.10/include/holidays/mz.rem +25 -0
  435. data/remind-v06.02.10/include/holidays/na.rem +27 -0
  436. data/remind-v06.02.10/include/holidays/ng.rem +21 -0
  437. data/remind-v06.02.10/include/holidays/ni/mn.rem +14 -0
  438. data/remind-v06.02.10/include/holidays/ni.rem +24 -0
  439. data/remind-v06.02.10/include/holidays/nl.rem +26 -0
  440. data/remind-v06.02.10/include/holidays/no.rem +19 -0
  441. data/remind-v06.02.10/include/holidays/nz/auk.rem +13 -0
  442. data/remind-v06.02.10/include/holidays/nz/can.rem +13 -0
  443. data/remind-v06.02.10/include/holidays/nz/cit.rem +13 -0
  444. data/remind-v06.02.10/include/holidays/nz/hkb.rem +13 -0
  445. data/remind-v06.02.10/include/holidays/nz/mbh.rem +13 -0
  446. data/remind-v06.02.10/include/holidays/nz/nsn.rem +13 -0
  447. data/remind-v06.02.10/include/holidays/nz/ntl.rem +13 -0
  448. data/remind-v06.02.10/include/holidays/nz/ota.rem +14 -0
  449. data/remind-v06.02.10/include/holidays/nz/south_canterbury.rem +13 -0
  450. data/remind-v06.02.10/include/holidays/nz/stl.rem +13 -0
  451. data/remind-v06.02.10/include/holidays/nz/tki.rem +13 -0
  452. data/remind-v06.02.10/include/holidays/nz/wgn.rem +13 -0
  453. data/remind-v06.02.10/include/holidays/nz/wtc.rem +13 -0
  454. data/remind-v06.02.10/include/holidays/nz.rem +69 -0
  455. data/remind-v06.02.10/include/holidays/pa.rem +27 -0
  456. data/remind-v06.02.10/include/holidays/pagan.rem +65 -0
  457. data/remind-v06.02.10/include/holidays/pe.rem +22 -0
  458. data/remind-v06.02.10/include/holidays/pg.rem +24 -0
  459. data/remind-v06.02.10/include/holidays/ph.rem +26 -0
  460. data/remind-v06.02.10/include/holidays/pk.rem +13 -0
  461. data/remind-v06.02.10/include/holidays/pl.rem +20 -0
  462. data/remind-v06.02.10/include/holidays/pr.rem +40 -0
  463. data/remind-v06.02.10/include/holidays/pt/01.rem +13 -0
  464. data/remind-v06.02.10/include/holidays/pt/02.rem +13 -0
  465. data/remind-v06.02.10/include/holidays/pt/03.rem +13 -0
  466. data/remind-v06.02.10/include/holidays/pt/04.rem +13 -0
  467. data/remind-v06.02.10/include/holidays/pt/05.rem +13 -0
  468. data/remind-v06.02.10/include/holidays/pt/06.rem +13 -0
  469. data/remind-v06.02.10/include/holidays/pt/07.rem +13 -0
  470. data/remind-v06.02.10/include/holidays/pt/08.rem +13 -0
  471. data/remind-v06.02.10/include/holidays/pt/09.rem +13 -0
  472. data/remind-v06.02.10/include/holidays/pt/10.rem +13 -0
  473. data/remind-v06.02.10/include/holidays/pt/12.rem +13 -0
  474. data/remind-v06.02.10/include/holidays/pt/13.rem +13 -0
  475. data/remind-v06.02.10/include/holidays/pt/14.rem +13 -0
  476. data/remind-v06.02.10/include/holidays/pt/15.rem +13 -0
  477. data/remind-v06.02.10/include/holidays/pt/16.rem +13 -0
  478. data/remind-v06.02.10/include/holidays/pt/18.rem +13 -0
  479. data/remind-v06.02.10/include/holidays/pt/20.rem +13 -0
  480. data/remind-v06.02.10/include/holidays/pt/30.rem +14 -0
  481. data/remind-v06.02.10/include/holidays/pt.rem +17 -0
  482. data/remind-v06.02.10/include/holidays/pw.rem +34 -0
  483. data/remind-v06.02.10/include/holidays/py.rem +20 -0
  484. data/remind-v06.02.10/include/holidays/ro.rem +24 -0
  485. data/remind-v06.02.10/include/holidays/rs.rem +26 -0
  486. data/remind-v06.02.10/include/holidays/ru.rem +21 -0
  487. data/remind-v06.02.10/include/holidays/sa.rem +13 -0
  488. data/remind-v06.02.10/include/holidays/sc.rem +28 -0
  489. data/remind-v06.02.10/include/holidays/se.rem +23 -0
  490. data/remind-v06.02.10/include/holidays/sg.rem +16 -0
  491. data/remind-v06.02.10/include/holidays/si.rem +20 -0
  492. data/remind-v06.02.10/include/holidays/sk.rem +25 -0
  493. data/remind-v06.02.10/include/holidays/sm.rem +25 -0
  494. data/remind-v06.02.10/include/holidays/sv/ss.rem +14 -0
  495. data/remind-v06.02.10/include/holidays/sv.rem +25 -0
  496. data/remind-v06.02.10/include/holidays/sz.rem +26 -0
  497. data/remind-v06.02.10/include/holidays/td.rem +22 -0
  498. data/remind-v06.02.10/include/holidays/th.rem +72 -0
  499. data/remind-v06.02.10/include/holidays/tl.rem +31 -0
  500. data/remind-v06.02.10/include/holidays/tn.rem +15 -0
  501. data/remind-v06.02.10/include/holidays/to.rem +38 -0
  502. data/remind-v06.02.10/include/holidays/tr.rem +17 -0
  503. data/remind-v06.02.10/include/holidays/tw.rem +26 -0
  504. data/remind-v06.02.10/include/holidays/tz.rem +23 -0
  505. data/remind-v06.02.10/include/holidays/ua.rem +20 -0
  506. data/remind-v06.02.10/include/holidays/uk.rem +27 -0
  507. data/remind-v06.02.10/include/holidays/um.rem +32 -0
  508. data/remind-v06.02.10/include/holidays/us/ak.rem +17 -0
  509. data/remind-v06.02.10/include/holidays/us/al.rem +17 -0
  510. data/remind-v06.02.10/include/holidays/us/ar.rem +13 -0
  511. data/remind-v06.02.10/include/holidays/us/as.rem +20 -0
  512. data/remind-v06.02.10/include/holidays/us/az.rem +14 -0
  513. data/remind-v06.02.10/include/holidays/us/ca.rem +16 -0
  514. data/remind-v06.02.10/include/holidays/us/co.rem +14 -0
  515. data/remind-v06.02.10/include/holidays/us/ct.rem +17 -0
  516. data/remind-v06.02.10/include/holidays/us/dc.rem +16 -0
  517. data/remind-v06.02.10/include/holidays/us/de.rem +14 -0
  518. data/remind-v06.02.10/include/holidays/us/fl.rem +14 -0
  519. data/remind-v06.02.10/include/holidays/us/ga.rem +18 -0
  520. data/remind-v06.02.10/include/holidays/us/gu.rem +17 -0
  521. data/remind-v06.02.10/include/holidays/us/hi.rem +19 -0
  522. data/remind-v06.02.10/include/holidays/us/ia.rem +15 -0
  523. data/remind-v06.02.10/include/holidays/us/id.rem +14 -0
  524. data/remind-v06.02.10/include/holidays/us/il.rem +17 -0
  525. data/remind-v06.02.10/include/holidays/us/in.rem +19 -0
  526. data/remind-v06.02.10/include/holidays/us/ks.rem +16 -0
  527. data/remind-v06.02.10/include/holidays/us/ky.rem +16 -0
  528. data/remind-v06.02.10/include/holidays/us/la.rem +14 -0
  529. data/remind-v06.02.10/include/holidays/us/ma.rem +17 -0
  530. data/remind-v06.02.10/include/holidays/us/md-extra.rem +19 -0
  531. data/remind-v06.02.10/include/holidays/us/md.rem +14 -0
  532. data/remind-v06.02.10/include/holidays/us/me.rem +14 -0
  533. data/remind-v06.02.10/include/holidays/us/mi.rem +19 -0
  534. data/remind-v06.02.10/include/holidays/us/mo.rem +16 -0
  535. data/remind-v06.02.10/include/holidays/us/mp.rem +23 -0
  536. data/remind-v06.02.10/include/holidays/us/ms.rem +14 -0
  537. data/remind-v06.02.10/include/holidays/us/mt.rem +13 -0
  538. data/remind-v06.02.10/include/holidays/us/nc.rem +22 -0
  539. data/remind-v06.02.10/include/holidays/us/ne.rem +14 -0
  540. data/remind-v06.02.10/include/holidays/us/nh.rem +14 -0
  541. data/remind-v06.02.10/include/holidays/us/nj.rem +17 -0
  542. data/remind-v06.02.10/include/holidays/us/nm.rem +14 -0
  543. data/remind-v06.02.10/include/holidays/us/nv.rem +16 -0
  544. data/remind-v06.02.10/include/holidays/us/ny.rem +17 -0
  545. data/remind-v06.02.10/include/holidays/us/oh.rem +13 -0
  546. data/remind-v06.02.10/include/holidays/us/ok.rem +13 -0
  547. data/remind-v06.02.10/include/holidays/us/pa.rem +14 -0
  548. data/remind-v06.02.10/include/holidays/us/pr.rem +21 -0
  549. data/remind-v06.02.10/include/holidays/us/ri.rem +14 -0
  550. data/remind-v06.02.10/include/holidays/us/sc.rem +13 -0
  551. data/remind-v06.02.10/include/holidays/us/sd.rem +13 -0
  552. data/remind-v06.02.10/include/holidays/us/tn.rem +13 -0
  553. data/remind-v06.02.10/include/holidays/us/tx.rem +25 -0
  554. data/remind-v06.02.10/include/holidays/us/ut.rem +16 -0
  555. data/remind-v06.02.10/include/holidays/us/va.rem +13 -0
  556. data/remind-v06.02.10/include/holidays/us/vi.rem +22 -0
  557. data/remind-v06.02.10/include/holidays/us/vt.rem +16 -0
  558. data/remind-v06.02.10/include/holidays/us/wi.rem +20 -0
  559. data/remind-v06.02.10/include/holidays/us/wv.rem +17 -0
  560. data/remind-v06.02.10/include/holidays/us.rem +41 -0
  561. data/remind-v06.02.10/include/holidays/uy.rem +39 -0
  562. data/remind-v06.02.10/include/holidays/uz.rem +21 -0
  563. data/remind-v06.02.10/include/holidays/va.rem +23 -0
  564. data/remind-v06.02.10/include/holidays/ve.rem +21 -0
  565. data/remind-v06.02.10/include/holidays/vi.rem +41 -0
  566. data/remind-v06.02.10/include/holidays/vn.rem +17 -0
  567. data/remind-v06.02.10/include/holidays/vu.rem +32 -0
  568. data/remind-v06.02.10/include/holidays/ws.rem +18 -0
  569. data/remind-v06.02.10/include/holidays/za.rem +28 -0
  570. data/remind-v06.02.10/include/holidays/zm.rem +31 -0
  571. data/remind-v06.02.10/include/lang/auto.rem +32 -0
  572. data/remind-v06.02.10/include/lang/ca.rem +60 -0
  573. data/remind-v06.02.10/include/lang/da.rem +77 -0
  574. data/remind-v06.02.10/include/lang/de.rem +80 -0
  575. data/remind-v06.02.10/include/lang/en.rem +4 -0
  576. data/remind-v06.02.10/include/lang/es.rem +55 -0
  577. data/remind-v06.02.10/include/lang/fi.rem +202 -0
  578. data/remind-v06.02.10/include/lang/fr.rem +172 -0
  579. data/remind-v06.02.10/include/lang/gr.rem +74 -0
  580. data/remind-v06.02.10/include/lang/is.rem +58 -0
  581. data/remind-v06.02.10/include/lang/it.rem +76 -0
  582. data/remind-v06.02.10/include/lang/nl.rem +71 -0
  583. data/remind-v06.02.10/include/lang/no.rem +66 -0
  584. data/remind-v06.02.10/include/lang/pl.rem +177 -0
  585. data/remind-v06.02.10/include/lang/pt.rem +176 -0
  586. data/remind-v06.02.10/include/lang/ro.rem +74 -0
  587. data/remind-v06.02.10/include/lunar-eclipses.rem +149 -0
  588. data/remind-v06.02.10/include/moonphases.rem +19 -0
  589. data/remind-v06.02.10/include/seasons.rem +21 -0
  590. data/remind-v06.02.10/include/solar-eclipses.rem +238 -0
  591. data/remind-v06.02.10/include/sun.rem +12 -0
  592. data/remind-v06.02.10/include/translations/de/holidays/chinese-new-year.rem +13 -0
  593. data/remind-v06.02.10/include/translations/de/moonphases.rem +4 -0
  594. data/remind-v06.02.10/include/translations/de/seasons.rem +4 -0
  595. data/remind-v06.02.10/include/translations/de/sun.rem +2 -0
  596. data/remind-v06.02.10/include/translations/nl/holidays/chinese-new-year.rem +13 -0
  597. data/remind-v06.02.10/include/translations/nl/moonphases.rem +4 -0
  598. data/remind-v06.02.10/include/translations/nl/seasons.rem +4 -0
  599. data/remind-v06.02.10/include/translations/nl/sun.rem +2 -0
  600. data/remind-v06.02.10/include/utils/add-html-anchors.rem +5 -0
  601. data/remind-v06.02.10/install-sh +238 -0
  602. data/remind-v06.02.10/man/rem.1.in +21 -0
  603. data/remind-v06.02.10/man/rem2ps.1.in +816 -0
  604. data/remind-v06.02.10/man/remind.1.in +7658 -0
  605. data/remind-v06.02.10/man/tkremind.1.in +612 -0
  606. data/remind-v06.02.10/rem2html/Makefile.in +30 -0
  607. data/remind-v06.02.10/rem2html/rem2html.in +1299 -0
  608. data/remind-v06.02.10/rem2pdf/Makefile.PL.in +25 -0
  609. data/remind-v06.02.10/rem2pdf/Makefile.top.in +50 -0
  610. data/remind-v06.02.10/rem2pdf/bin/rem2pdf.in +761 -0
  611. data/remind-v06.02.10/scripts/tkremind.in +5794 -0
  612. data/remind-v06.02.10/src/Makefile.in +133 -0
  613. data/remind-v06.02.10/src/calendar.c +3069 -0
  614. data/remind-v06.02.10/src/config.h +117 -0
  615. data/remind-v06.02.10/src/config.h.in +116 -0
  616. data/remind-v06.02.10/src/custom.h +167 -0
  617. data/remind-v06.02.10/src/custom.h.in +167 -0
  618. data/remind-v06.02.10/src/dedupe.c +179 -0
  619. data/remind-v06.02.10/src/dorem.c +2389 -0
  620. data/remind-v06.02.10/src/dosubst.c +910 -0
  621. data/remind-v06.02.10/src/dynbuf.c +198 -0
  622. data/remind-v06.02.10/src/dynbuf.h +41 -0
  623. data/remind-v06.02.10/src/err.h +294 -0
  624. data/remind-v06.02.10/src/expr.c +3408 -0
  625. data/remind-v06.02.10/src/files.c +1437 -0
  626. data/remind-v06.02.10/src/funcs.c +5230 -0
  627. data/remind-v06.02.10/src/globals.c +23 -0
  628. data/remind-v06.02.10/src/globals.h +277 -0
  629. data/remind-v06.02.10/src/hashtab.c +428 -0
  630. data/remind-v06.02.10/src/hashtab.h +88 -0
  631. data/remind-v06.02.10/src/hashtab_stats.c +101 -0
  632. data/remind-v06.02.10/src/hbcal.c +579 -0
  633. data/remind-v06.02.10/src/ifelse.c +236 -0
  634. data/remind-v06.02.10/src/init.c +1494 -0
  635. data/remind-v06.02.10/src/json.c +1048 -0
  636. data/remind-v06.02.10/src/json.h +276 -0
  637. data/remind-v06.02.10/src/main.c +2310 -0
  638. data/remind-v06.02.10/src/md5.c +250 -0
  639. data/remind-v06.02.10/src/md5.h +33 -0
  640. data/remind-v06.02.10/src/moon.c +957 -0
  641. data/remind-v06.02.10/src/omit.c +560 -0
  642. data/remind-v06.02.10/src/protos.h +284 -0
  643. data/remind-v06.02.10/src/queue.c +1118 -0
  644. data/remind-v06.02.10/src/rem2ps.c +1383 -0
  645. data/remind-v06.02.10/src/rem2ps.h +229 -0
  646. data/remind-v06.02.10/src/sort.c +257 -0
  647. data/remind-v06.02.10/src/token.c +494 -0
  648. data/remind-v06.02.10/src/trans.c +544 -0
  649. data/remind-v06.02.10/src/trigger.c +871 -0
  650. data/remind-v06.02.10/src/types.h +341 -0
  651. data/remind-v06.02.10/src/userfns.c +810 -0
  652. data/remind-v06.02.10/src/utils.c +374 -0
  653. data/remind-v06.02.10/src/var.c +1762 -0
  654. data/remind-v06.02.10/src/version.h +1 -0
  655. data/remind-v06.02.10/src/version.h.in +1 -0
  656. data/remind-v06.02.10/src/xlat.c +100 -0
  657. data/remind-v06.02.10/www/Makefile.in +91 -0
  658. metadata +764 -0
@@ -0,0 +1,1437 @@
1
+ /***************************************************************/
2
+ /* */
3
+ /* FILES.C */
4
+ /* */
5
+ /* Controls the opening and closing of files, etc. Also */
6
+ /* handles caching of lines and reading of lines from */
7
+ /* files. */
8
+ /* */
9
+ /* This file is part of REMIND. */
10
+ /* Copyright (C) 1992-2026 by Dianne Skoll */
11
+ /* SPDX-License-Identifier: GPL-2.0-only */
12
+ /* */
13
+ /***************************************************************/
14
+
15
+ #include "config.h"
16
+
17
+ #include <stdio.h>
18
+ #include <fcntl.h>
19
+ #include <string.h>
20
+ #include <errno.h>
21
+ #include <ctype.h>
22
+ #include <sys/stat.h>
23
+ #include <stddef.h>
24
+
25
+ #ifdef TM_IN_SYS_TIME
26
+ #include <sys/time.h>
27
+ #else
28
+ #include <time.h>
29
+ #endif
30
+
31
+ #include <sys/types.h>
32
+ #include <stdlib.h>
33
+ #include <unistd.h>
34
+
35
+ #ifdef HAVE_GLOB_H
36
+ #include <glob.h>
37
+ #endif
38
+
39
+ #include "types.h"
40
+ #include "protos.h"
41
+ #include "globals.h"
42
+ #include "err.h"
43
+
44
+ #ifdef USE_READLINE
45
+ #include <readline/readline.h>
46
+ #endif
47
+ #ifdef USE_READLINE_HISTORY
48
+ #include <readline/history.h>
49
+ #endif
50
+
51
+
52
+ /* Convenient macros for closing files */
53
+ #define FCLOSE(fp) ((((fp)!=stdin)) ? (fclose(fp),(fp)=NULL) : ((fp)=NULL))
54
+ #define PCLOSE(fp) ((((fp)!=stdin)) ? (pclose(fp),(fp)=NULL) : ((fp)=NULL))
55
+
56
+ /* Define the structures needed by the file caching system */
57
+ typedef struct cache {
58
+ struct cache *next;
59
+ char const *text;
60
+ int LineNo;
61
+ int LineNoStart;
62
+ } CachedLine;
63
+
64
+ typedef struct cheader {
65
+ struct cheader *next;
66
+ char const *filename;
67
+ CachedLine *cache;
68
+ int ownedByMe;
69
+ int lines_cached;
70
+ } CachedFile;
71
+
72
+ /* A linked list of filenames if we INCLUDE /some/directory/ */
73
+ typedef struct fname_chain {
74
+ struct fname_chain *next;
75
+ char const *filename;
76
+ } FilenameChain;
77
+
78
+ /* Cache filename chains for directories */
79
+ typedef struct directory_fname_chain {
80
+ struct directory_fname_chain *next;
81
+ FilenameChain *chain;
82
+ char const *dirname;
83
+ } DirectoryFilenameChain;
84
+
85
+ /* Define the structures needed by the INCLUDE file system */
86
+ typedef struct {
87
+ char const *filename;
88
+ FilenameChain *chain;
89
+ int LineNo;
90
+ int LineNoStart;
91
+ int base_if_pointer;
92
+ long offset;
93
+ CachedLine *CLine;
94
+ int ownedByMe;
95
+ } IncludeStruct;
96
+
97
+ typedef struct fn_entry {
98
+ struct hash_link link;
99
+ char const *fname;
100
+ } FilenameHashEntry;
101
+
102
+ /* A hash table to hold unique copies of all the filenames we process */
103
+ static hash_table FilenameHashTable;
104
+
105
+ static CachedFile *CachedFiles = (CachedFile *) NULL;
106
+ static CachedLine *CLine = (CachedLine *) NULL;
107
+ static DirectoryFilenameChain *CachedDirectoryChains = NULL;
108
+
109
+ /* Current filename */
110
+ static char const *FileName = NULL;
111
+
112
+ static FILE *fp;
113
+
114
+ static IncludeStruct IStack[INCLUDE_NEST];
115
+ static int IStackPtr = 0;
116
+
117
+ static int ReadLineFromFile (int use_pclose);
118
+ static int CacheFile (char const *fname, int use_pclose);
119
+ static void DestroyCache (CachedFile *cf);
120
+ static int CheckSafety (void);
121
+ static int CheckSafetyAux (struct stat *statbuf);
122
+ static int PopFile (void);
123
+ static int IncludeCmd(char const *);
124
+
125
+ static unsigned int FnHashFunc(void const *x)
126
+ {
127
+ FilenameHashEntry const *e = (FilenameHashEntry const *) x;
128
+ return HashVal_preservecase(e->fname);
129
+ }
130
+
131
+ static int FnCompareFunc(void const *a, void const *b)
132
+ {
133
+ FilenameHashEntry const *e1 = (FilenameHashEntry const *) a;
134
+ FilenameHashEntry const *e2 = (FilenameHashEntry const *) b;
135
+ return strcmp(e1->fname, e2->fname);
136
+ }
137
+
138
+ void InitFiles(void)
139
+ {
140
+ if (hash_table_init(&FilenameHashTable, offsetof(FilenameHashEntry, link),
141
+ FnHashFunc, FnCompareFunc) < 0) {
142
+ fprintf(ErrFp, "Unable to initialize filename hash table: Out of memory. Exiting.\n");
143
+ exit(1);
144
+ }
145
+ #ifdef USE_READLINE_HISTORY
146
+ using_history();
147
+ #endif
148
+ }
149
+
150
+ void SetCurrentFilename(char const *fname)
151
+ {
152
+ FilenameHashEntry *e;
153
+ FilenameHashEntry candidate;
154
+ candidate.fname = fname;
155
+
156
+ e = (FilenameHashEntry *) hash_table_find(&FilenameHashTable, &candidate);
157
+ if (!e) {
158
+ e = NEW(FilenameHashEntry);
159
+ if (!e) {
160
+ fprintf(ErrFp, "Out of Memory!\n");
161
+ exit(1);
162
+ }
163
+ e->fname = strdup(fname);
164
+ if (!e->fname) {
165
+ fprintf(ErrFp, "Out of Memory!\n");
166
+ exit(1);
167
+ }
168
+ hash_table_insert(&FilenameHashTable, e);
169
+ }
170
+ FileName = e->fname;
171
+ }
172
+
173
+ char const *GetCurrentFilename(void)
174
+ {
175
+ if (FileName) {
176
+ if (!strcmp(FileName, "-")) {
177
+ return "-stdin-";
178
+ } else {
179
+ return FileName;
180
+ }
181
+ } else {
182
+ return "";
183
+ }
184
+ }
185
+
186
+ static void
187
+ got_a_fresh_line(void)
188
+ {
189
+ FreshLine = 1;
190
+ WarnedAboutImplicit = 0;
191
+ ExpressionNodesEvaluatedThisLine = 0;
192
+ }
193
+
194
+ void set_cloexec(int fd)
195
+ {
196
+ int flags;
197
+
198
+ flags = fcntl(fd, F_GETFD);
199
+ if (flags >= 0) {
200
+ flags |= FD_CLOEXEC;
201
+ fcntl(fd, F_SETFD, flags);
202
+ }
203
+ }
204
+
205
+
206
+ static void OpenPurgeFile(char const *fname, char const *mode)
207
+ {
208
+ DynamicBuffer fname_buf;
209
+
210
+ if (PurgeFP != NULL && PurgeFP != stdout) {
211
+ fclose(PurgeFP);
212
+ }
213
+ PurgeFP = NULL;
214
+
215
+ /* Do not open a purge file if we're below purge
216
+ include depth */
217
+ if (IStackPtr-2 >= PurgeIncludeDepth) {
218
+ PurgeFP = NULL;
219
+ return;
220
+ }
221
+
222
+ DBufInit(&fname_buf);
223
+ if (DBufPuts(&fname_buf, fname) != OK) return;
224
+ if (DBufPuts(&fname_buf, ".purged") != OK) return;
225
+ PurgeFP = fopen(DBufValue(&fname_buf), mode);
226
+ if (!PurgeFP) {
227
+ fprintf(ErrFp, tr("Cannot open `%s' for writing: %s"), DBufValue(&fname_buf), strerror(errno));
228
+ fprintf(ErrFp, "\n");
229
+ } else {
230
+ set_cloexec(fileno(PurgeFP));
231
+ }
232
+ DBufFree(&fname_buf);
233
+ }
234
+
235
+ static void FreeChainItem(FilenameChain *chain)
236
+ {
237
+ if (chain->filename) free((void *) chain->filename);
238
+ free(chain);
239
+ }
240
+
241
+ static void FreeChain(FilenameChain *chain)
242
+ {
243
+ FilenameChain *next;
244
+ while(chain) {
245
+ next = chain->next;
246
+ FreeChainItem(chain);
247
+ chain = next;
248
+ }
249
+ }
250
+
251
+ /***************************************************************/
252
+ /* */
253
+ /* ReadLine */
254
+ /* */
255
+ /* Read a line from the file or cache. */
256
+ /* */
257
+ /***************************************************************/
258
+ int ReadLine(void)
259
+ {
260
+ int r;
261
+
262
+ /* If we're at the end of a file, pop */
263
+ while (!CLine && !fp) {
264
+ r = PopFile();
265
+ if (r) return r;
266
+ }
267
+
268
+ /* If it's cached, read line from the cache */
269
+ if (CLine) {
270
+ CurLine = CLine->text;
271
+ LineNo = CLine->LineNo;
272
+ LineNoStart = CLine->LineNoStart;
273
+ CLine = CLine->next;
274
+ got_a_fresh_line();
275
+ clear_callstack();
276
+ if (DebugFlag & DB_ECHO_LINE) OutputLine(ErrFp);
277
+ return OK;
278
+ }
279
+
280
+ /* Not cached. Read from the file. */
281
+ return ReadLineFromFile(0);
282
+ }
283
+
284
+ #define IS_INTERACTIVE() (fileno(fp) == STDIN_FILENO && isatty(STDIN_FILENO) && isatty(STDOUT_FILENO))
285
+
286
+ /***************************************************************/
287
+ /* */
288
+ /* ReadLineFromFile */
289
+ /* */
290
+ /* Read a line from the file pointed to by fp. */
291
+ /* */
292
+ /***************************************************************/
293
+ static int ReadLineFromFile(int use_pclose)
294
+ {
295
+ int l, r;
296
+ char copy_buffer[4096];
297
+ size_t n;
298
+ int force_eof = 0;
299
+
300
+ #ifdef USE_READLINE
301
+ int read_some = 0;
302
+ char prompt[64];
303
+ #endif
304
+
305
+ DynamicBuffer buf;
306
+
307
+ DBufInit(&buf);
308
+ DBufFree(&LineBuffer);
309
+
310
+ LineNoStart = LineNo+1;
311
+
312
+ if (!fp) {
313
+ return E_EOF;
314
+ }
315
+ while(fp) {
316
+ #ifdef USE_READLINE
317
+ if (IS_INTERACTIVE()) {
318
+ char *lin;
319
+ if (should_ignore_line()) {
320
+ if (read_some) {
321
+ snprintf(prompt, sizeof(prompt), "%4d: Rem...? ", LineNo+1);
322
+ } else {
323
+ snprintf(prompt, sizeof(prompt), "%4d: Remind? ", LineNo+1);
324
+ }
325
+ } else {
326
+ if (read_some) {
327
+ snprintf(prompt, sizeof(prompt), "%4d: Rem...> ", LineNo+1);
328
+ } else {
329
+ snprintf(prompt, sizeof(prompt), "%4d: Remind> ", LineNo+1);
330
+ }
331
+ }
332
+ lin = readline(prompt);
333
+ if (lin) {
334
+ read_some = 1;
335
+ DBufFree(&buf);
336
+ if (DBufPuts(&buf, lin) != OK) {
337
+ free(lin);
338
+ DBufFree(&buf);
339
+ return E_NO_MEM;
340
+ }
341
+ free(lin);
342
+ force_eof = 0;
343
+ } else {
344
+ force_eof = 1;
345
+ }
346
+ } else {
347
+ #endif
348
+ if ((r = DBufGets(&buf, fp, MaxLineLength)) != OK) {
349
+ LineNo++;
350
+ DBufFree(&LineBuffer);
351
+ return r;
352
+ }
353
+ #ifdef USE_READLINE
354
+ }
355
+ #endif
356
+ LineNo++;
357
+ if (ferror(fp)) {
358
+ DBufFree(&buf);
359
+ DBufFree(&LineBuffer);
360
+ return E_IO_ERR;
361
+ }
362
+ if (use_pclose && MaxIncludeCmdLines > 0 && LineNo-1 > MaxIncludeCmdLines) {
363
+ DBufFree(&buf);
364
+ DBufFree(&LineBuffer);
365
+ return E_CMD_TOO_MUCH_OUTPUT;
366
+ }
367
+
368
+ if (feof(fp) || force_eof) {
369
+ if (use_pclose) {
370
+ PCLOSE(fp);
371
+ } else {
372
+ FCLOSE(fp);
373
+ }
374
+ if ((DBufLen(&buf) == 0) &&
375
+ (DBufLen(&LineBuffer) == 0) && PurgeMode) {
376
+ if (PurgeFP != NULL && PurgeFP != stdout) fclose(PurgeFP);
377
+ PurgeFP = NULL;
378
+ }
379
+ }
380
+ l = DBufLen(&buf);
381
+ if (l && (DBufValue(&buf)[l-1] == '\\')) {
382
+ if (PurgeMode) {
383
+ if (DBufPuts(&LineBuffer, DBufValue(&buf)) != OK) {
384
+ DBufFree(&buf);
385
+ DBufFree(&LineBuffer);
386
+ return E_NO_MEM;
387
+ }
388
+ if (DBufPutc(&LineBuffer, '\n') != OK) {
389
+ DBufFree(&buf);
390
+ DBufFree(&LineBuffer);
391
+ return E_NO_MEM;
392
+ }
393
+ } else {
394
+ DBufValue(&buf)[l-1] = '\n';
395
+ if (DBufPuts(&LineBuffer, DBufValue(&buf)) != OK) {
396
+ DBufFree(&buf);
397
+ DBufFree(&LineBuffer);
398
+ return E_NO_MEM;
399
+ }
400
+ }
401
+ if (MaxLineLength > 0 && DBufLen(&LineBuffer) > (size_t) MaxLineLength) {
402
+ DBufFree(&buf);
403
+ DBufFree(&LineBuffer);
404
+ return E_LINE_TOO_LONG;
405
+ }
406
+ continue;
407
+ }
408
+ if (DBufPuts(&LineBuffer, DBufValue(&buf)) != OK) {
409
+ DBufFree(&buf);
410
+ DBufFree(&LineBuffer);
411
+ return E_NO_MEM;
412
+ }
413
+ DBufFree(&buf);
414
+ if (MaxLineLength > 0 && DBufLen(&LineBuffer) > (size_t) MaxLineLength) {
415
+ DBufFree(&LineBuffer);
416
+ return E_LINE_TOO_LONG;
417
+ }
418
+
419
+ /* If the line is: __EOF__ treat it as end-of-file */
420
+ CurLine = DBufValue(&LineBuffer);
421
+ if (!strcmp(CurLine, "__EOF__")) {
422
+ if (PurgeMode && PurgeFP) {
423
+ PurgeEchoLine("%s\n", "__EOF__");
424
+ while ((n = fread(copy_buffer, 1, sizeof(copy_buffer), fp)) != 0) {
425
+ fwrite(copy_buffer, 1, n, PurgeFP);
426
+ }
427
+ if (PurgeFP != stdout) fclose(PurgeFP);
428
+ PurgeFP = NULL;
429
+ }
430
+ if (use_pclose) {
431
+ PCLOSE(fp);
432
+ } else {
433
+ FCLOSE(fp);
434
+ }
435
+ DBufFree(&LineBuffer);
436
+ CurLine = DBufValue(&LineBuffer);
437
+ }
438
+
439
+ #ifdef USE_READLINE_HISTORY
440
+ if (fp && IS_INTERACTIVE()) {
441
+ add_history(CurLine);
442
+ }
443
+ #endif
444
+ got_a_fresh_line();
445
+ clear_callstack();
446
+ if (DebugFlag & DB_ECHO_LINE) OutputLine(ErrFp);
447
+ return OK;
448
+ }
449
+ CurLine = DBufValue(&LineBuffer);
450
+ return OK;
451
+ }
452
+
453
+ /***************************************************************/
454
+ /* */
455
+ /* OpenFile */
456
+ /* */
457
+ /* Open a file for reading. If it's in the cache, set */
458
+ /* CLine. Otherwise, open it on disk and set fp. If */
459
+ /* ShouldCache is 1, cache the file */
460
+ /* */
461
+ /***************************************************************/
462
+ static int OpenFile(char const *fname)
463
+ {
464
+ CachedFile *h = CachedFiles;
465
+ int r;
466
+
467
+ if (PurgeMode) {
468
+ if (PurgeFP != NULL && PurgeFP != stdout) {
469
+ fclose(PurgeFP);
470
+ }
471
+ PurgeFP = NULL;
472
+ }
473
+
474
+ /* If it's in the cache, get it from there. */
475
+
476
+ while (h) {
477
+ if (!strcmp(fname, h->filename)) {
478
+ if (DebugFlag & DB_TRACE_FILES) {
479
+ fprintf(ErrFp, tr("Reading `%s': Found in cache"), fname);
480
+ fprintf(ErrFp, "\n");
481
+ }
482
+ fp = NULL;
483
+ CLine = h->cache;
484
+ SetCurrentFilename(fname);
485
+ LineNo = 0;
486
+ LineNoStart = 0;
487
+ if (!h->ownedByMe) {
488
+ RunDisabled |= RUN_NOTOWNER;
489
+ } else {
490
+ RunDisabled &= ~RUN_NOTOWNER;
491
+ }
492
+ if (FileName) return OK; else return E_NO_MEM;
493
+ }
494
+ h = h->next;
495
+ }
496
+
497
+ /* If it's a dash, then it's stdin */
498
+ if (!strcmp(fname, "-")) {
499
+ fp = stdin;
500
+ RunDisabled &= ~RUN_NOTOWNER;
501
+ if (PurgeMode) {
502
+ PurgeFP = stdout;
503
+ }
504
+ if (DebugFlag & DB_TRACE_FILES) {
505
+ fprintf(ErrFp, "%s\n", tr("Reading `-': Reading stdin"));
506
+ }
507
+ } else {
508
+ if (DebugFlag & DB_TRACE_FILES) {
509
+ fprintf(ErrFp, tr("Reading `%s': Opening file on disk"), fname);
510
+ fprintf(ErrFp, "\n");
511
+ }
512
+ fp = fopen(fname, "r");
513
+ if (!fp) {
514
+ Eprint(tr("Can't open `%s' for reading: %s"), fname, strerror(errno));
515
+ return E_CANT_OPEN;
516
+ } else {
517
+ set_cloexec(fileno(fp));
518
+ }
519
+ if (PurgeMode) {
520
+ OpenPurgeFile(fname, "w");
521
+ }
522
+ }
523
+ if (!fp || !CheckSafety()) return E_CANT_OPEN;
524
+ CLine = NULL;
525
+ if (ShouldCache) {
526
+ LineNo = 0;
527
+ LineNoStart = 0;
528
+ r = CacheFile(fname, 0);
529
+ if (r == OK) {
530
+ fp = NULL;
531
+ CLine = CachedFiles->cache;
532
+ } else {
533
+ if (strcmp(fname, "-")) {
534
+ fp = fopen(fname, "r");
535
+ if (!fp) {
536
+ Eprint(tr("Can't open `%s' for reading: %s"), fname, strerror(errno));
537
+ return E_CANT_OPEN;
538
+ }
539
+ if (!CheckSafety()) return E_CANT_OPEN;
540
+ set_cloexec(fileno(fp));
541
+ if (PurgeMode) OpenPurgeFile(fname, "w");
542
+ } else {
543
+ fp = stdin;
544
+ if (PurgeMode) PurgeFP = stdout;
545
+ }
546
+ }
547
+ }
548
+ SetCurrentFilename(fname);
549
+ LineNo = 0;
550
+ LineNoStart = 0;
551
+ if (FileName) return OK; else return E_NO_MEM;
552
+ }
553
+
554
+ /***************************************************************/
555
+ /* */
556
+ /* CacheFile */
557
+ /* */
558
+ /* Cache a file in memory. If we fail, set ShouldCache to 0 */
559
+ /* Returns an indication of success or failure. */
560
+ /* */
561
+ /***************************************************************/
562
+ static int CacheFile(char const *fname, int use_pclose)
563
+ {
564
+ int r;
565
+ CachedFile *cf;
566
+ CachedLine *cl;
567
+ char const *s;
568
+
569
+ if (DebugFlag & DB_TRACE_FILES) {
570
+ fprintf(ErrFp, tr("Caching file `%s' in memory"), fname);
571
+ fprintf(ErrFp, "\n");
572
+ }
573
+ cl = NULL;
574
+ /* Create a file header */
575
+ cf = NEW(CachedFile);
576
+ if (!cf) {
577
+ ShouldCache = 0;
578
+ if (use_pclose) {
579
+ PCLOSE(fp);
580
+ } else {
581
+ FCLOSE(fp);
582
+ }
583
+ return E_NO_MEM;
584
+ }
585
+ cf->cache = NULL;
586
+ cf->lines_cached = 0;
587
+ cf->filename = strdup(fname);
588
+ if (!cf->filename) {
589
+ ShouldCache = 0;
590
+ if (use_pclose) {
591
+ PCLOSE(fp);
592
+ } else {
593
+ FCLOSE(fp);
594
+ }
595
+ free(cf);
596
+ return E_NO_MEM;
597
+ }
598
+
599
+ if (RunDisabled & RUN_NOTOWNER) {
600
+ cf->ownedByMe = 0;
601
+ } else {
602
+ cf->ownedByMe = 1;
603
+ }
604
+
605
+ /* Read the file */
606
+ while(fp) {
607
+ r = ReadLineFromFile(use_pclose);
608
+ if (r) {
609
+ DestroyCache(cf);
610
+ ShouldCache = 0;
611
+ if (use_pclose) {
612
+ PCLOSE(fp);
613
+ } else {
614
+ FCLOSE(fp);
615
+ }
616
+ return r;
617
+ }
618
+
619
+ /* Skip blank chars */
620
+ s = DBufValue(&LineBuffer);
621
+ while (isempty(*s)) s++;
622
+ if (*s && *s!=';' && *s!='#') {
623
+ /* Add the line to the cache */
624
+ cf->lines_cached++;
625
+ if (cf->lines_cached > MaxCachedLines) {
626
+ DBufFree(&LineBuffer);
627
+ DestroyCache(cf);
628
+ ShouldCache = 0;
629
+ if (use_pclose) {
630
+ PCLOSE(fp);
631
+ } else {
632
+ FCLOSE(fp);
633
+ }
634
+ return E_TOO_MANY_CACHED_LINES;
635
+ }
636
+
637
+ if (!cl) {
638
+ cf->cache = NEW(CachedLine);
639
+ if (!cf->cache) {
640
+ DBufFree(&LineBuffer);
641
+ DestroyCache(cf);
642
+ ShouldCache = 0;
643
+ if (use_pclose) {
644
+ PCLOSE(fp);
645
+ } else {
646
+ FCLOSE(fp);
647
+ }
648
+ return E_NO_MEM;
649
+ }
650
+ cl = cf->cache;
651
+ } else {
652
+ cl->next = NEW(CachedLine);
653
+ if (!cl->next) {
654
+ DBufFree(&LineBuffer);
655
+ DestroyCache(cf);
656
+ ShouldCache = 0;
657
+ if (use_pclose) {
658
+ PCLOSE(fp);
659
+ } else {
660
+ FCLOSE(fp);
661
+ }
662
+ return E_NO_MEM;
663
+ }
664
+ cl = cl->next;
665
+ }
666
+ cl->next = NULL;
667
+ cl->LineNo = LineNo;
668
+ cl->LineNoStart = LineNoStart;
669
+ cl->text = strdup(s);
670
+ DBufFree(&LineBuffer);
671
+ if (!cl->text) {
672
+ DestroyCache(cf);
673
+ ShouldCache = 0;
674
+ if (use_pclose) {
675
+ PCLOSE(fp);
676
+ } else {
677
+ FCLOSE(fp);
678
+ }
679
+ return E_NO_MEM;
680
+ }
681
+ }
682
+ }
683
+
684
+ /* Put the cached file at the head of the queue */
685
+ cf->next = CachedFiles;
686
+ CachedFiles = cf;
687
+
688
+ return OK;
689
+ }
690
+
691
+ /***************************************************************/
692
+ /* */
693
+ /* NextChainedFile - move to the next chained file in a glob */
694
+ /* list. */
695
+ /* */
696
+ /***************************************************************/
697
+ static int NextChainedFile(IncludeStruct *i)
698
+ {
699
+ while(i->chain) {
700
+ FilenameChain *cur = i->chain;
701
+ i->chain = i->chain->next;
702
+ if (OpenFile(cur->filename) == OK) {
703
+ return OK;
704
+ } else {
705
+ Eprint("%s: %s", GetErr(E_CANT_OPEN), cur->filename);
706
+ }
707
+ }
708
+ return E_EOF;
709
+ }
710
+
711
+ /***************************************************************/
712
+ /* */
713
+ /* PopFile - we've reached the end. Pop up to the previous */
714
+ /* file, or return E_EOF */
715
+ /* */
716
+ /***************************************************************/
717
+ static int PopFile(void)
718
+ {
719
+ IncludeStruct *i;
720
+
721
+ pop_excess_ifs(FileName);
722
+ fp = NULL;
723
+
724
+ if (!IStackPtr) return E_EOF;
725
+ i = &IStack[IStackPtr-1];
726
+
727
+ if (i->chain) {
728
+ int oldRunDisabled = RunDisabled;
729
+ if (NextChainedFile(i) == OK) {
730
+ return OK;
731
+ }
732
+ RunDisabled = oldRunDisabled;
733
+ }
734
+
735
+ if (TopLevel()) {
736
+ IStackPtr = 0;
737
+ return E_EOF;
738
+ }
739
+ IStackPtr--;
740
+
741
+ LineNo = i->LineNo;
742
+ LineNoStart = i->LineNoStart;
743
+ set_base_if_pointer(i->base_if_pointer);
744
+ CLine = i->CLine;
745
+ SetCurrentFilename(i->filename);
746
+ if (!i->ownedByMe) {
747
+ RunDisabled |= RUN_NOTOWNER;
748
+ } else {
749
+ RunDisabled &= ~RUN_NOTOWNER;
750
+ }
751
+ if (!CLine && (i->offset != -1L || !strcmp(i->filename, "-"))) {
752
+ /* We must open the file, then seek to specified position */
753
+ if (strcmp(i->filename, "-")) {
754
+ fp = fopen(i->filename, "r");
755
+ if (!fp) {
756
+ Eprint(tr("Can't open `%s' for reading: %s"), i->filename, strerror(errno));
757
+ return E_CANT_OPEN;
758
+ }
759
+ if (!CheckSafety()) return E_CANT_OPEN;
760
+ set_cloexec(fileno(fp));
761
+ if (PurgeMode) OpenPurgeFile(i->filename, "a");
762
+ } else {
763
+ fp = stdin;
764
+ if (PurgeMode) PurgeFP = stdout;
765
+ }
766
+ if (fp != stdin)
767
+ (void) fseek(fp, i->offset, 0); /* Trust that it works... */
768
+ }
769
+ return OK;
770
+ }
771
+
772
+ /***************************************************************/
773
+ /* */
774
+ /* DoInclude */
775
+ /* */
776
+ /* The INCLUDE command. */
777
+ /* */
778
+ /***************************************************************/
779
+ int DoInclude(ParsePtr p, enum TokTypes tok)
780
+ {
781
+ DynamicBuffer buf;
782
+ DynamicBuffer fullname;
783
+ DynamicBuffer path;
784
+ int r, e;
785
+
786
+ r = OK;
787
+ char const *s;
788
+ DBufInit(&buf);
789
+ DBufInit(&fullname);
790
+ DBufInit(&path);
791
+ if ( (r=ParseTokenOrQuotedString(p, &buf)) ) return r;
792
+ e = VerifyEoln(p);
793
+ if (e) Eprint("%s", GetErr(e));
794
+
795
+ if ((tok == T_IncludeR || tok == T_IncludeSys) &&
796
+ *(DBufValue(&buf)) != '/') {
797
+ /* Relative include: Include relative to dir
798
+ containing current file */
799
+ if (tok == T_IncludeR) {
800
+ if (DBufPuts(&path, FileName) != OK) {
801
+ r = E_NO_MEM;
802
+ goto bailout;
803
+ }
804
+ } else {
805
+ if (DBufPuts(&path, SysDir) != OK ||
806
+ DBufPutc(&path, '/') != OK) {
807
+ r = E_NO_MEM;
808
+ goto bailout;
809
+ }
810
+ }
811
+ if (DBufLen(&path) == 0) {
812
+ s = DBufValue(&buf);
813
+ } else {
814
+ char *t = DBufValue(&path) + DBufLen(&path) - 1;
815
+ while (t > DBufValue(&path) && *t != '/') t--;
816
+ if (*t == '/') {
817
+ *t = 0;
818
+ if (DBufPuts(&fullname, DBufValue(&path)) != OK) {
819
+ r = E_NO_MEM;
820
+ goto bailout;
821
+ }
822
+ if (DBufPuts(&fullname, "/") != OK) {
823
+ r = E_NO_MEM;
824
+ goto bailout;
825
+ }
826
+ if (DBufPuts(&fullname, DBufValue(&buf)) != OK) {
827
+ r = E_NO_MEM;
828
+ goto bailout;
829
+ }
830
+ s = DBufValue(&fullname);
831
+ } else {
832
+ s = DBufValue(&buf);
833
+ }
834
+ }
835
+ } else {
836
+ s = DBufValue(&buf);
837
+ }
838
+ if ( (r=IncludeFile(s)) ) {
839
+ goto bailout;
840
+ }
841
+
842
+ bailout:
843
+ DBufFree(&buf);
844
+ DBufFree(&path);
845
+ DBufFree(&fullname);
846
+ return r;
847
+ }
848
+
849
+ /***************************************************************/
850
+ /* */
851
+ /* DoIncludeCmd */
852
+ /* */
853
+ /* The INCLUDECMD command. */
854
+ /* */
855
+ /***************************************************************/
856
+ int DoIncludeCmd(ParsePtr p)
857
+ {
858
+ DynamicBuffer buf;
859
+ int r;
860
+ int ch;
861
+ char append_buf[2];
862
+ int seen_nonspace = 0;
863
+
864
+ append_buf[1] = 0;
865
+
866
+ DBufInit(&buf);
867
+
868
+ while(1) {
869
+ ch = ParseChar(p, &r, 0);
870
+ if (r) {
871
+ DBufFree(&buf);
872
+ return r;
873
+ }
874
+ if (!ch) {
875
+ break;
876
+ }
877
+ if (isspace(ch) && !seen_nonspace) {
878
+ continue;
879
+ }
880
+ seen_nonspace = 1;
881
+ /* Convert \n to ' ' to better handle line continuation */
882
+ if (ch == '\n') {
883
+ ch = ' ';
884
+ }
885
+ append_buf[0] = (char) ch;
886
+ if (DBufPuts(&buf, append_buf) != OK) {
887
+ DBufFree(&buf);
888
+ return E_NO_MEM;
889
+ }
890
+ }
891
+
892
+ if (RunDisabled) {
893
+ DBufFree(&buf);
894
+ return E_RUN_DISABLED;
895
+ }
896
+
897
+ if ( (r=IncludeCmd(DBufValue(&buf))) != 0) {
898
+ DBufFree(&buf);
899
+ return r;
900
+ }
901
+ DBufFree(&buf);
902
+ return OK;
903
+ }
904
+
905
+ #ifdef HAVE_GLOB
906
+ static int SetupGlobChain(char const *dirname, IncludeStruct *i)
907
+ {
908
+ DynamicBuffer pattern;
909
+ char *dir;
910
+ size_t l;
911
+ int r;
912
+ glob_t glob_buf;
913
+ struct stat sb;
914
+
915
+ DirectoryFilenameChain *dc = CachedDirectoryChains;
916
+
917
+ i->chain = NULL;
918
+ if (!*dirname) return E_CANT_OPEN;
919
+
920
+ dir = strdup(dirname);
921
+ if (!dir) return E_NO_MEM;
922
+
923
+ /* Strip trailing slashes off directory */
924
+ l = strlen(dir);
925
+ while(l) {
926
+ if (*(dir+l-1) == '/') {
927
+ l--;
928
+ *(dir+l) = 0;
929
+ } else {
930
+ break;
931
+ }
932
+ }
933
+
934
+ /* Repair root directory :-) */
935
+ if (!l) {
936
+ *dir = '/';
937
+ }
938
+
939
+ /* Check the cache */
940
+ while(dc) {
941
+ if (!strcmp(dc->dirname, dir)) {
942
+ if (DebugFlag & DB_TRACE_FILES) {
943
+ fprintf(ErrFp, tr("Found cached directory listing for `%s'"),
944
+ dir);
945
+ fprintf(ErrFp, "\n");
946
+ }
947
+ free(dir);
948
+ i->chain = dc->chain;
949
+ return OK;
950
+ }
951
+ dc = dc->next;
952
+ }
953
+
954
+ if (DebugFlag & DB_TRACE_FILES) {
955
+ fprintf(ErrFp, tr("Scanning directory `%s' for *.rem files"), dir);
956
+ fprintf(ErrFp, "\n");
957
+ }
958
+
959
+ if (ShouldCache) {
960
+ dc = malloc(sizeof(DirectoryFilenameChain));
961
+ if (dc) {
962
+ dc->dirname = strdup(dir);
963
+ if (!dc->dirname) {
964
+ free(dc);
965
+ dc = NULL;
966
+ }
967
+ }
968
+ if (dc) {
969
+ if (DebugFlag & DB_TRACE_FILES) {
970
+ fprintf(ErrFp, tr("Caching directory `%s' listing"), dir);
971
+ fprintf(ErrFp, "\n");
972
+ }
973
+
974
+ dc->chain = NULL;
975
+ dc->next = CachedDirectoryChains;
976
+ CachedDirectoryChains = dc;
977
+ }
978
+ }
979
+
980
+ DBufInit(&pattern);
981
+ DBufPuts(&pattern, dir);
982
+ DBufPuts(&pattern, "/*.rem");
983
+ free(dir);
984
+
985
+ r = glob(DBufValue(&pattern), 0, NULL, &glob_buf);
986
+ DBufFree(&pattern);
987
+
988
+ if (r == GLOB_NOMATCH) {
989
+ globfree(&glob_buf);
990
+ return OK;
991
+ }
992
+
993
+ if (r != 0) {
994
+ globfree(&glob_buf);
995
+ return -1;
996
+ }
997
+
998
+ /* Add the files to the chain backwards to preserve sort order */
999
+ for (r=glob_buf.gl_pathc-1; r>=0; r--) {
1000
+ if (stat(glob_buf.gl_pathv[r], &sb) < 0) {
1001
+ /* Couldn't stat the file... fuggedaboutit */
1002
+ continue;
1003
+ }
1004
+
1005
+ /* Don't add directories */
1006
+ if (S_ISDIR(sb.st_mode)) {
1007
+ continue;
1008
+ }
1009
+
1010
+ FilenameChain *ch = malloc(sizeof(FilenameChain));
1011
+ if (!ch) {
1012
+ globfree(&glob_buf);
1013
+ FreeChain(i->chain);
1014
+ i->chain = NULL;
1015
+ return E_NO_MEM;
1016
+ }
1017
+
1018
+ ch->filename = strdup(glob_buf.gl_pathv[r]);
1019
+ if (!ch->filename) {
1020
+ globfree(&glob_buf);
1021
+ FreeChain(i->chain);
1022
+ i->chain = NULL;
1023
+ free(ch);
1024
+ return E_NO_MEM;
1025
+ }
1026
+ ch->next = i->chain;
1027
+ i->chain = ch;
1028
+ }
1029
+ if (dc) {
1030
+ dc->chain = i->chain;
1031
+ }
1032
+
1033
+ globfree(&glob_buf);
1034
+ return OK;
1035
+ }
1036
+ #endif
1037
+
1038
+ /***************************************************************/
1039
+ /* */
1040
+ /* IncludeCmd */
1041
+ /* */
1042
+ /* Process the INCLUDECMD command - actually do the command */
1043
+ /* inclusion. */
1044
+ /* */
1045
+ /***************************************************************/
1046
+ static int IncludeCmd(char const *cmd)
1047
+ {
1048
+ IncludeStruct *i;
1049
+ DynamicBuffer buf;
1050
+ FILE *fp2;
1051
+ int r;
1052
+ CachedFile *h;
1053
+ char const *fname;
1054
+ int old_flag;
1055
+ int stdin_dup, devnull;
1056
+
1057
+ got_a_fresh_line();
1058
+ clear_callstack();
1059
+ if (IStackPtr >= INCLUDE_NEST) return E_NESTED_INCLUDE;
1060
+ i = &IStack[IStackPtr];
1061
+
1062
+ /* Use "cmd|" as the filename */
1063
+ DBufInit(&buf);
1064
+ if (DBufPuts(&buf, cmd) != OK) {
1065
+ DBufFree(&buf);
1066
+ return E_NO_MEM;
1067
+ }
1068
+ if (DBufPuts(&buf, "|") != OK) {
1069
+ DBufFree(&buf);
1070
+ return E_NO_MEM;
1071
+ }
1072
+ fname = DBufValue(&buf);
1073
+
1074
+ i->filename = FileName;
1075
+ i->ownedByMe = 1;
1076
+ i->LineNo = LineNo;
1077
+ i->LineNoStart = LineNo;
1078
+ i->base_if_pointer = get_base_if_pointer();
1079
+ i->CLine = CLine;
1080
+ i->offset = -1L;
1081
+ i->chain = NULL;
1082
+ if (fp) {
1083
+ i->offset = ftell(fp);
1084
+ FCLOSE(fp);
1085
+ }
1086
+ IStackPtr++;
1087
+
1088
+ set_base_if_pointer(get_if_pointer());
1089
+
1090
+ /* If the file is cached, use it */
1091
+ h = CachedFiles;
1092
+ while(h) {
1093
+ if (!strcmp(fname, h->filename)) {
1094
+ if (DebugFlag & DB_TRACE_FILES) {
1095
+ fprintf(ErrFp, tr("Reading command `%s': Found in cache"), fname);
1096
+ fprintf(ErrFp, "\n");
1097
+ }
1098
+ CLine = h->cache;
1099
+ SetCurrentFilename(fname);
1100
+ DBufFree(&buf);
1101
+ LineNo = 0;
1102
+ LineNoStart = 0;
1103
+ if (!h->ownedByMe) {
1104
+ RunDisabled |= RUN_NOTOWNER;
1105
+ } else {
1106
+ RunDisabled &= ~RUN_NOTOWNER;
1107
+ }
1108
+ if (FileName) return OK; else return E_NO_MEM;
1109
+ }
1110
+ h = h->next;
1111
+ }
1112
+
1113
+ if (DebugFlag & DB_TRACE_FILES) {
1114
+ fprintf(ErrFp, tr("Executing `%s' for INCLUDECMD and caching as `%s'"),
1115
+ cmd, fname);
1116
+ fprintf(ErrFp, "\n");
1117
+ }
1118
+
1119
+ /* Not found in cache */
1120
+
1121
+ /* Connect stdin to /dev/null */
1122
+ stdin_dup = dup(STDIN_FILENO);
1123
+ if (stdin_dup >= 0) {
1124
+ devnull = open("/dev/null", O_RDONLY);
1125
+ if (devnull >= 0) {
1126
+ if (dup2(devnull, STDIN_FILENO) >= 0) {
1127
+ set_cloexec(stdin_dup);
1128
+ } else {
1129
+ (void) close(stdin_dup);
1130
+ stdin_dup = -1;
1131
+ }
1132
+ (void) close(devnull);
1133
+ }
1134
+ }
1135
+
1136
+ /* If cmd starts with !, then disable RUN within the cmd output */
1137
+ if (cmd[0] == '!') {
1138
+ fp2 = popen(cmd+1, "r");
1139
+ } else {
1140
+ fp2 = popen(cmd, "r");
1141
+ }
1142
+ if (!fp2) {
1143
+ Eprint(tr("Cannot execute `%s': %s"), (cmd[0] == '!' ? cmd+1 : cmd), strerror(errno));
1144
+ PopFile();
1145
+ DBufFree(&buf);
1146
+ if (stdin_dup >= 0) {
1147
+ (void) dup2(stdin_dup, STDIN_FILENO);
1148
+ (void) close(stdin_dup);
1149
+ }
1150
+ return E_CANT_OPEN;
1151
+ }
1152
+ fp = fp2;
1153
+ LineNo = 0;
1154
+ LineNoStart = 0;
1155
+
1156
+ /* Temporarily turn of file tracing */
1157
+ old_flag = DebugFlag;
1158
+ DebugFlag &= (~DB_TRACE_FILES);
1159
+
1160
+ if (cmd[0] == '!') {
1161
+ RunDisabled |= RUN_NOTOWNER;
1162
+ }
1163
+ r = CacheFile(fname, 1);
1164
+
1165
+ if (stdin_dup >= 0) {
1166
+ (void) dup2(stdin_dup, STDIN_FILENO);
1167
+ (void) close(stdin_dup);
1168
+ }
1169
+
1170
+ DebugFlag = old_flag;
1171
+ if (r == OK) {
1172
+ fp = NULL;
1173
+ CLine = CachedFiles->cache;
1174
+ LineNo = 0;
1175
+ LineNoStart = 0;
1176
+ SetCurrentFilename(fname);
1177
+ /* Can only free buf AFTER we set the filename
1178
+ because fname points into buf */
1179
+ DBufFree(&buf);
1180
+ return OK;
1181
+ }
1182
+ DBufFree(&buf);
1183
+ /* We failed */
1184
+ PopFile();
1185
+ return r;
1186
+ }
1187
+
1188
+ /***************************************************************/
1189
+ /* */
1190
+ /* IncludeFile */
1191
+ /* */
1192
+ /* Process the INCLUDE command - actually do the file */
1193
+ /* inclusion. */
1194
+ /* */
1195
+ /***************************************************************/
1196
+ int IncludeFile(char const *fname)
1197
+ {
1198
+ IncludeStruct *i;
1199
+ int oldRunDisabled;
1200
+ struct stat statbuf;
1201
+
1202
+ got_a_fresh_line();
1203
+ clear_callstack();
1204
+ if (IStackPtr >= INCLUDE_NEST) return E_NESTED_INCLUDE;
1205
+ i = &IStack[IStackPtr];
1206
+
1207
+ i->filename = FileName;
1208
+ i->LineNo = LineNo;
1209
+ i->LineNoStart = LineNoStart;
1210
+ i->base_if_pointer = get_base_if_pointer();
1211
+ i->CLine = CLine;
1212
+ i->offset = -1L;
1213
+ i->chain = NULL;
1214
+ if (RunDisabled & RUN_NOTOWNER) {
1215
+ i->ownedByMe = 0;
1216
+ } else {
1217
+ i->ownedByMe = 1;
1218
+ }
1219
+ if (fp) {
1220
+ i->offset = ftell(fp);
1221
+ FCLOSE(fp);
1222
+ }
1223
+
1224
+ IStackPtr++;
1225
+ set_base_if_pointer(get_if_pointer());
1226
+
1227
+ #ifdef HAVE_GLOB
1228
+ /* If it's a directory, set up the glob chain here. */
1229
+ if (stat(fname, &statbuf) == 0) {
1230
+ FilenameChain *fc;
1231
+ if (S_ISDIR(statbuf.st_mode)) {
1232
+ /* Check safety */
1233
+ if (!CheckSafetyAux(&statbuf)) {
1234
+ PopFile();
1235
+ return E_NO_MATCHING_REMS;
1236
+ }
1237
+ if (SetupGlobChain(fname, i) == OK) { /* Glob succeeded */
1238
+ if (!i->chain) { /* Oops... no matching files */
1239
+ if (!Hush) {
1240
+ Eprint("%s: %s", fname, GetErr(E_NO_MATCHING_REMS));
1241
+ }
1242
+ PopFile();
1243
+ return E_NO_MATCHING_REMS;
1244
+ }
1245
+ while(i->chain) {
1246
+ fc = i->chain;
1247
+ i->chain = i->chain->next;
1248
+
1249
+ /* Munch first file */
1250
+ oldRunDisabled = RunDisabled;
1251
+ if (!OpenFile(fc->filename)) {
1252
+ return OK;
1253
+ }
1254
+ Eprint("%s: %s", GetErr(E_CANT_OPEN), fc->filename);
1255
+ RunDisabled = oldRunDisabled;
1256
+ }
1257
+ /* Couldn't open anything... bail */
1258
+ return PopFile();
1259
+ } else {
1260
+ if (!Hush) {
1261
+ Eprint("%s: %s", fname, GetErr(E_NO_MATCHING_REMS));
1262
+ }
1263
+ }
1264
+ return E_NO_MATCHING_REMS;
1265
+ }
1266
+ }
1267
+ #endif
1268
+
1269
+ oldRunDisabled = RunDisabled;
1270
+ /* Try to open the new file */
1271
+ if (!OpenFile(fname)) {
1272
+ return OK;
1273
+ }
1274
+ RunDisabled = oldRunDisabled;
1275
+ Eprint("%s: %s", GetErr(E_CANT_OPEN), fname);
1276
+ /* Ugh! We failed! */
1277
+ PopFile();
1278
+ return E_CANT_OPEN;
1279
+ }
1280
+
1281
+ /***************************************************************/
1282
+ /* */
1283
+ /* GetAccessDate - get the access date of a file. */
1284
+ /* */
1285
+ /***************************************************************/
1286
+ int GetAccessDate(char const *file)
1287
+ {
1288
+ struct stat statbuf;
1289
+ struct tm const *t1;
1290
+
1291
+ if (stat(file, &statbuf)) return -1;
1292
+ t1 = localtime(&(statbuf.st_atime));
1293
+
1294
+ if (t1->tm_year + 1900 < BASE)
1295
+ return 0;
1296
+ else
1297
+ return DSE(t1->tm_year+1900, t1->tm_mon, t1->tm_mday);
1298
+ }
1299
+
1300
+ /***************************************************************/
1301
+ /* */
1302
+ /* DestroyCache */
1303
+ /* */
1304
+ /* Free all the memory used by a cached file. */
1305
+ /* */
1306
+ /***************************************************************/
1307
+ static void DestroyCache(CachedFile *cf)
1308
+ {
1309
+ CachedLine *cl, *cnext;
1310
+ CachedFile *temp;
1311
+ if (cf->filename) free((char *) cf->filename);
1312
+ cl = cf->cache;
1313
+ while (cl) {
1314
+ if (cl->text) free ((char *) cl->text);
1315
+ cnext = cl->next;
1316
+ free(cl);
1317
+ cl = cnext;
1318
+ }
1319
+ if (CachedFiles == cf) CachedFiles = cf->next;
1320
+ else {
1321
+ temp = CachedFiles;
1322
+ while(temp) {
1323
+ if (temp->next == cf) {
1324
+ temp->next = cf->next;
1325
+ break;
1326
+ }
1327
+ temp = temp->next;
1328
+ }
1329
+ }
1330
+ free(cf);
1331
+ }
1332
+
1333
+ /***************************************************************/
1334
+ /* */
1335
+ /* TopLevel */
1336
+ /* */
1337
+ /* Returns 1 if current file is top level, 0 otherwise. */
1338
+ /* */
1339
+ /***************************************************************/
1340
+ int TopLevel(void)
1341
+ {
1342
+ return IStackPtr <= 1;
1343
+ }
1344
+
1345
+ /***************************************************************/
1346
+ /* */
1347
+ /* CheckSafety */
1348
+ /* */
1349
+ /* Returns 1 if current file is safe to read; 0 otherwise. */
1350
+ /* If we are running as root, we refuse to open files not */
1351
+ /* owned by root. */
1352
+ /* We also reject world-writable files, no matter */
1353
+ /* who we're running as. */
1354
+ /* As a side effect, if we don't own the file, or it's not */
1355
+ /* owned by a trusted user, we disable RUN */
1356
+ /***************************************************************/
1357
+ static int CheckSafety(void)
1358
+ {
1359
+ struct stat statbuf;
1360
+
1361
+ if (fp == stdin) {
1362
+ return 1;
1363
+ }
1364
+
1365
+ if (fstat(fileno(fp), &statbuf)) {
1366
+ fclose(fp);
1367
+ fp = NULL;
1368
+ return 0;
1369
+ }
1370
+
1371
+ if (S_ISDIR(statbuf.st_mode)) {
1372
+ fclose(fp);
1373
+ fp = NULL;
1374
+ return 0;
1375
+ }
1376
+
1377
+ if (!CheckSafetyAux(&statbuf)) {
1378
+ fclose(fp);
1379
+ fp = NULL;
1380
+ return 0;
1381
+ }
1382
+ return 1;
1383
+ }
1384
+
1385
+ /***************************************************************/
1386
+ /* */
1387
+ /* CheckSafetyAux */
1388
+ /* */
1389
+ /* Returns 1 if file whos info is in statbuf is safe to read; */
1390
+ /* 0 otherwise. If we are running as */
1391
+ /* root, we refuse to open files not owned by root. */
1392
+ /* We also reject world-writable files, no matter */
1393
+ /* who we're running as. */
1394
+ /* As a side effect, if we don't own the file, or it's not */
1395
+ /* owned by a trusted user, we disable RUN */
1396
+ /***************************************************************/
1397
+
1398
+ static int CheckSafetyAux(struct stat *statbuf)
1399
+ {
1400
+ /* Under UNIX, take extra precautions if running as root */
1401
+ if (!geteuid()) {
1402
+ /* Reject files not owned by root or group/world writable */
1403
+ if (statbuf->st_uid != 0) {
1404
+ fprintf(ErrFp, "%s\n", tr("SECURITY: Won't read non-root-owned file or directory when running as root!"));
1405
+ return 0;
1406
+ }
1407
+ }
1408
+ /* Sigh... /dev/null is usually world-writable, so ignore devices,
1409
+ FIFOs, sockets, etc. */
1410
+ if (!S_ISREG(statbuf->st_mode) && !S_ISDIR(statbuf->st_mode)) {
1411
+ return 1;
1412
+ }
1413
+ if ((statbuf->st_mode & S_IWOTH)) {
1414
+ fprintf(ErrFp, "%s\n", tr("SECURITY: Won't read world-writable file or directory!"));
1415
+ return 0;
1416
+ }
1417
+
1418
+ /* If file is not owned by me or a trusted user, disable RUN command */
1419
+
1420
+ /* Assume unsafe */
1421
+ RunDisabled |= RUN_NOTOWNER;
1422
+ if (statbuf->st_uid == geteuid()) {
1423
+ /* Owned by me... safe */
1424
+ RunDisabled &= ~RUN_NOTOWNER;
1425
+ } else {
1426
+ int i;
1427
+ for (i=0; i<NumTrustedUsers; i++) {
1428
+ if (statbuf->st_uid == TrustedUsers[i]) {
1429
+ /* Owned by a trusted user... safe */
1430
+ RunDisabled &= ~RUN_NOTOWNER;
1431
+ break;
1432
+ }
1433
+ }
1434
+ }
1435
+
1436
+ return 1;
1437
+ }