home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume42 / sacdrt / part01 next >
Encoding:
Internet Message Format  |  1994-05-06  |  85.1 KB

  1. From: hagenl@cs.tu-berlin.de (Lars Hagen)
  2. Newsgroups: comp.sources.misc,sci.astro,sci.space
  3. Subject: v42i078:  sacdrt - SAC-Database-Reader for DeepSky Objects, Part01/04
  4. Date: 6 May 1994 14:45:11 -0500
  5. Organization: Technical University of Berlin, Germany
  6. Sender: kent@sparky.sterling.com
  7. Approved: kent@sparky.sterling.com
  8. Message-ID: <csm-v42i078=sacdrt.144402@sparky.sterling.com>
  9. X-Md4-Signature: 26da66d841f26a2969727c3ac444f46b
  10.  
  11. Submitted-by: hagenl@cs.tu-berlin.de (Lars Hagen)
  12. Posting-number: Volume 42, Issue 78
  13. Archive-name: sacdrt/part01
  14. Environment: ncurses, a2ps, gmake, SunOS, Linux
  15.  
  16. SACDRT Version 3.1 SAC-Database-Reader for DeepSky Objects
  17.  
  18. Sacdrt is a reader and translater for the sac databse version 5.2 and 
  19. version 6.0. Lower versions might work, but not tested.
  20. Sacdrt will input the databse, parse the entries and show them on the screen
  21. (one bye one). You can mark objects, search (by name and other), sort the
  22. marked objects (by name, declination, rektaszension, magnitude, type and const)
  23. and you can do a complex search (see manual page), e.g. to get all objects
  24. with NGC in the name and magnutide from 4 up to 8.
  25. The marked objects could be printed, wether in a file or to a printer (ascii
  26. or ps). For further information refer to the manual page.
  27.  
  28. The installation of this program requires the NCURSES package (version 1.8
  29. or greater, lower versions may be work but they are not tested) and GMAKE
  30. (don't know if the makefiles will work with the normal make).
  31. When you want to print ps you need also the A2PS from Miguel SANTANA.
  32.  
  33. Tested under: SunOS and Linux pl.12
  34.  
  35.  
  36. THANKS TO: Zeyd (and every one who helped improve the ncurses)!!!
  37.            Sven Mathing and Stefan Arbanowski. 
  38.            Steve Coe for a lot of help by the realisation of the parsers.
  39.            Carsten Borman for new ideas.
  40.            Hellmuth Michaelis for initrc[c,h] code.
  41.            Miguel SANTANA for the a2ps.
  42.  
  43. have fun.
  44.  
  45. hagenl@cs.tu-berlin.de
  46. vdmeer@cs.tu-berlin.de
  47.  
  48. -- 
  49. =================================
  50. =   Lars Hagen                  =
  51. =   Technical University        =
  52. =   Berlin, Germany             =
  53. ----------------------------------
  54. #! /bin/sh
  55. # This is a shell archive.  Remove anything before this line, then feed it
  56. # into a shell via "sh file" or similar.  To overwrite existing files,
  57. # type "sh file -c".
  58. # Contents:  sacdrt3.1 sacdrt3.1/COPYING sacdrt3.1/man
  59. #   sacdrt3.1/man/sacdrt.1 sacdrt3.1/sacdrt_term
  60. #   sacdrt3.1/sacdrt_term/input.c sacdrt3.1/sacdrt_term/mark_objects.c
  61. #   sacdrt3.1/sacdrt_term/p_cord.c sacdrt3.1/sacdrt_term/p_descr.c
  62. # Wrapped by kent@sparky on Fri May  6 14:38:19 1994
  63. PATH=/bin:/usr/bin:/usr/ucb:/usr/local/bin:/usr/lbin:$PATH ; export PATH
  64. echo If this archive is complete, you will see the following message:
  65. echo '          "shar: End of archive 1 (of 4)."'
  66. if test ! -d 'sacdrt3.1' ; then
  67.     echo shar: Creating directory \"'sacdrt3.1'\"
  68.     mkdir 'sacdrt3.1'
  69. fi
  70. if test -f 'sacdrt3.1/COPYING' -a "${1}" != "-c" ; then 
  71.   echo shar: Will not clobber existing file \"'sacdrt3.1/COPYING'\"
  72. else
  73.   echo shar: Extracting \"'sacdrt3.1/COPYING'\" \(17982 characters\)
  74.   sed "s/^X//" >'sacdrt3.1/COPYING' <<'END_OF_FILE'
  75. X            GNU GENERAL PUBLIC LICENSE
  76. X               Version 2, June 1991
  77. X
  78. X Copyright (C) 1989, 1991 Free Software Foundation, Inc.
  79. X                          675 Mass Ave, Cambridge, MA 02139, USA
  80. X Everyone is permitted to copy and distribute verbatim copies
  81. X of this license document, but changing it is not allowed.
  82. X
  83. X                Preamble
  84. X
  85. X  The licenses for most software are designed to take away your
  86. Xfreedom to share and change it.  By contrast, the GNU General Public
  87. XLicense is intended to guarantee your freedom to share and change free
  88. Xsoftware--to make sure the software is free for all its users.  This
  89. XGeneral Public License applies to most of the Free Software
  90. XFoundation's software and to any other program whose authors commit to
  91. Xusing it.  (Some other Free Software Foundation software is covered by
  92. Xthe GNU Library General Public License instead.)  You can apply it to
  93. Xyour programs, too.
  94. X
  95. X  When we speak of free software, we are referring to freedom, not
  96. Xprice.  Our General Public Licenses are designed to make sure that you
  97. Xhave the freedom to distribute copies of free software (and charge for
  98. Xthis service if you wish), that you receive source code or can get it
  99. Xif you want it, that you can change the software or use pieces of it
  100. Xin new free programs; and that you know you can do these things.
  101. X
  102. X  To protect your rights, we need to make restrictions that forbid
  103. Xanyone to deny you these rights or to ask you to surrender the rights.
  104. XThese restrictions translate to certain responsibilities for you if you
  105. Xdistribute copies of the software, or if you modify it.
  106. X
  107. X  For example, if you distribute copies of such a program, whether
  108. Xgratis or for a fee, you must give the recipients all the rights that
  109. Xyou have.  You must make sure that they, too, receive or can get the
  110. Xsource code.  And you must show them these terms so they know their
  111. Xrights.
  112. X
  113. X  We protect your rights with two steps: (1) copyright the software, and
  114. X(2) offer you this license which gives you legal permission to copy,
  115. Xdistribute and/or modify the software.
  116. X
  117. X  Also, for each author's protection and ours, we want to make certain
  118. Xthat everyone understands that there is no warranty for this free
  119. Xsoftware.  If the software is modified by someone else and passed on, we
  120. Xwant its recipients to know that what they have is not the original, so
  121. Xthat any problems introduced by others will not reflect on the original
  122. Xauthors' reputations.
  123. X
  124. X  Finally, any free program is threatened constantly by software
  125. Xpatents.  We wish to avoid the danger that redistributors of a free
  126. Xprogram will individually obtain patent licenses, in effect making the
  127. Xprogram proprietary.  To prevent this, we have made it clear that any
  128. Xpatent must be licensed for everyone's free use or not licensed at all.
  129. X
  130. X  The precise terms and conditions for copying, distribution and
  131. Xmodification follow.
  132. X
  133. X            GNU GENERAL PUBLIC LICENSE
  134. X   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
  135. X
  136. X  0. This License applies to any program or other work which contains
  137. Xa notice placed by the copyright holder saying it may be distributed
  138. Xunder the terms of this General Public License.  The "Program", below,
  139. Xrefers to any such program or work, and a "work based on the Program"
  140. Xmeans either the Program or any derivative work under copyright law:
  141. Xthat is to say, a work containing the Program or a portion of it,
  142. Xeither verbatim or with modifications and/or translated into another
  143. Xlanguage.  (Hereinafter, translation is included without limitation in
  144. Xthe term "modification".)  Each licensee is addressed as "you".
  145. X
  146. XActivities other than copying, distribution and modification are not
  147. Xcovered by this License; they are outside its scope.  The act of
  148. Xrunning the Program is not restricted, and the output from the Program
  149. Xis covered only if its contents constitute a work based on the
  150. XProgram (independent of having been made by running the Program).
  151. XWhether that is true depends on what the Program does.
  152. X
  153. X  1. You may copy and distribute verbatim copies of the Program's
  154. Xsource code as you receive it, in any medium, provided that you
  155. Xconspicuously and appropriately publish on each copy an appropriate
  156. Xcopyright notice and disclaimer of warranty; keep intact all the
  157. Xnotices that refer to this License and to the absence of any warranty;
  158. Xand give any other recipients of the Program a copy of this License
  159. Xalong with the Program.
  160. X
  161. XYou may charge a fee for the physical act of transferring a copy, and
  162. Xyou may at your option offer warranty protection in exchange for a fee.
  163. X
  164. X  2. You may modify your copy or copies of the Program or any portion
  165. Xof it, thus forming a work based on the Program, and copy and
  166. Xdistribute such modifications or work under the terms of Section 1
  167. Xabove, provided that you also meet all of these conditions:
  168. X
  169. X    a) You must cause the modified files to carry prominent notices
  170. X    stating that you changed the files and the date of any change.
  171. X
  172. X    b) You must cause any work that you distribute or publish, that in
  173. X    whole or in part contains or is derived from the Program or any
  174. X    part thereof, to be licensed as a whole at no charge to all third
  175. X    parties under the terms of this License.
  176. X
  177. X    c) If the modified program normally reads commands interactively
  178. X    when run, you must cause it, when started running for such
  179. X    interactive use in the most ordinary way, to print or display an
  180. X    announcement including an appropriate copyright notice and a
  181. X    notice that there is no warranty (or else, saying that you provide
  182. X    a warranty) and that users may redistribute the program under
  183. X    these conditions, and telling the user how to view a copy of this
  184. X    License.  (Exception: if the Program itself is interactive but
  185. X    does not normally print such an announcement, your work based on
  186. X    the Program is not required to print an announcement.)
  187. X
  188. XThese requirements apply to the modified work as a whole.  If
  189. Xidentifiable sections of that work are not derived from the Program,
  190. Xand can be reasonably considered independent and separate works in
  191. Xthemselves, then this License, and its terms, do not apply to those
  192. Xsections when you distribute them as separate works.  But when you
  193. Xdistribute the same sections as part of a whole which is a work based
  194. Xon the Program, the distribution of the whole must be on the terms of
  195. Xthis License, whose permissions for other licensees extend to the
  196. Xentire whole, and thus to each and every part regardless of who wrote it.
  197. X
  198. XThus, it is not the intent of this section to claim rights or contest
  199. Xyour rights to work written entirely by you; rather, the intent is to
  200. Xexercise the right to control the distribution of derivative or
  201. Xcollective works based on the Program.
  202. X
  203. XIn addition, mere aggregation of another work not based on the Program
  204. Xwith the Program (or with a work based on the Program) on a volume of
  205. Xa storage or distribution medium does not bring the other work under
  206. Xthe scope of this License.
  207. X
  208. X  3. You may copy and distribute the Program (or a work based on it,
  209. Xunder Section 2) in object code or executable form under the terms of
  210. XSections 1 and 2 above provided that you also do one of the following:
  211. X
  212. X    a) Accompany it with the complete corresponding machine-readable
  213. X    source code, which must be distributed under the terms of Sections
  214. X    1 and 2 above on a medium customarily used for software interchange; or,
  215. X
  216. X    b) Accompany it with a written offer, valid for at least three
  217. X    years, to give any third party, for a charge no more than your
  218. X    cost of physically performing source distribution, a complete
  219. X    machine-readable copy of the corresponding source code, to be
  220. X    distributed under the terms of Sections 1 and 2 above on a medium
  221. X    customarily used for software interchange; or,
  222. X
  223. X    c) Accompany it with the information you received as to the offer
  224. X    to distribute corresponding source code.  (This alternative is
  225. X    allowed only for noncommercial distribution and only if you
  226. X    received the program in object code or executable form with such
  227. X    an offer, in accord with Subsection b above.)
  228. X
  229. XThe source code for a work means the preferred form of the work for
  230. Xmaking modifications to it.  For an executable work, complete source
  231. Xcode means all the source code for all modules it contains, plus any
  232. Xassociated interface definition files, plus the scripts used to
  233. Xcontrol compilation and installation of the executable.  However, as a
  234. Xspecial exception, the source code distributed need not include
  235. Xanything that is normally distributed (in either source or binary
  236. Xform) with the major components (compiler, kernel, and so on) of the
  237. Xoperating system on which the executable runs, unless that component
  238. Xitself accompanies the executable.
  239. X
  240. XIf distribution of executable or object code is made by offering
  241. Xaccess to copy from a designated place, then offering equivalent
  242. Xaccess to copy the source code from the same place counts as
  243. Xdistribution of the source code, even though third parties are not
  244. Xcompelled to copy the source along with the object code.
  245. X
  246. X  4. You may not copy, modify, sublicense, or distribute the Program
  247. Xexcept as expressly provided under this License.  Any attempt
  248. Xotherwise to copy, modify, sublicense or distribute the Program is
  249. Xvoid, and will automatically terminate your rights under this License.
  250. XHowever, parties who have received copies, or rights, from you under
  251. Xthis License will not have their licenses terminated so long as such
  252. Xparties remain in full compliance.
  253. X
  254. X  5. You are not required to accept this License, since you have not
  255. Xsigned it.  However, nothing else grants you permission to modify or
  256. Xdistribute the Program or its derivative works.  These actions are
  257. Xprohibited by law if you do not accept this License.  Therefore, by
  258. Xmodifying or distributing the Program (or any work based on the
  259. XProgram), you indicate your acceptance of this License to do so, and
  260. Xall its terms and conditions for copying, distributing or modifying
  261. Xthe Program or works based on it.
  262. X
  263. X  6. Each time you redistribute the Program (or any work based on the
  264. XProgram), the recipient automatically receives a license from the
  265. Xoriginal licensor to copy, distribute or modify the Program subject to
  266. Xthese terms and conditions.  You may not impose any further
  267. Xrestrictions on the recipients' exercise of the rights granted herein.
  268. XYou are not responsible for enforcing compliance by third parties to
  269. Xthis License.
  270. X
  271. X  7. If, as a consequence of a court judgment or allegation of patent
  272. Xinfringement or for any other reason (not limited to patent issues),
  273. Xconditions are imposed on you (whether by court order, agreement or
  274. Xotherwise) that contradict the conditions of this License, they do not
  275. Xexcuse you from the conditions of this License.  If you cannot
  276. Xdistribute so as to satisfy simultaneously your obligations under this
  277. XLicense and any other pertinent obligations, then as a consequence you
  278. Xmay not distribute the Program at all.  For example, if a patent
  279. Xlicense would not permit royalty-free redistribution of the Program by
  280. Xall those who receive copies directly or indirectly through you, then
  281. Xthe only way you could satisfy both it and this License would be to
  282. Xrefrain entirely from distribution of the Program.
  283. X
  284. XIf any portion of this section is held invalid or unenforceable under
  285. Xany particular circumstance, the balance of the section is intended to
  286. Xapply and the section as a whole is intended to apply in other
  287. Xcircumstances.
  288. X
  289. XIt is not the purpose of this section to induce you to infringe any
  290. Xpatents or other property right claims or to contest validity of any
  291. Xsuch claims; this section has the sole purpose of protecting the
  292. Xintegrity of the free software distribution system, which is
  293. Ximplemented by public license practices.  Many people have made
  294. Xgenerous contributions to the wide range of software distributed
  295. Xthrough that system in reliance on consistent application of that
  296. Xsystem; it is up to the author/donor to decide if he or she is willing
  297. Xto distribute software through any other system and a licensee cannot
  298. Ximpose that choice.
  299. X
  300. XThis section is intended to make thoroughly clear what is believed to
  301. Xbe a consequence of the rest of this License.
  302. X
  303. X  8. If the distribution and/or use of the Program is restricted in
  304. Xcertain countries either by patents or by copyrighted interfaces, the
  305. Xoriginal copyright holder who places the Program under this License
  306. Xmay add an explicit geographical distribution limitation excluding
  307. Xthose countries, so that distribution is permitted only in or among
  308. Xcountries not thus excluded.  In such case, this License incorporates
  309. Xthe limitation as if written in the body of this License.
  310. X
  311. X  9. The Free Software Foundation may publish revised and/or new versions
  312. Xof the General Public License from time to time.  Such new versions will
  313. Xbe similar in spirit to the present version, but may differ in detail to
  314. Xaddress new problems or concerns.
  315. X
  316. XEach version is given a distinguishing version number.  If the Program
  317. Xspecifies a version number of this License which applies to it and "any
  318. Xlater version", you have the option of following the terms and conditions
  319. Xeither of that version or of any later version published by the Free
  320. XSoftware Foundation.  If the Program does not specify a version number of
  321. Xthis License, you may choose any version ever published by the Free Software
  322. XFoundation.
  323. X
  324. X  10. If you wish to incorporate parts of the Program into other free
  325. Xprograms whose distribution conditions are different, write to the author
  326. Xto ask for permission.  For software which is copyrighted by the Free
  327. XSoftware Foundation, write to the Free Software Foundation; we sometimes
  328. Xmake exceptions for this.  Our decision will be guided by the two goals
  329. Xof preserving the free status of all derivatives of our free software and
  330. Xof promoting the sharing and reuse of software generally.
  331. X
  332. X                NO WARRANTY
  333. X
  334. X  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
  335. XFOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
  336. XOTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
  337. XPROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
  338. XOR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  339. XMERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
  340. XTO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
  341. XPROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
  342. XREPAIR OR CORRECTION.
  343. X
  344. X  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
  345. XWILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
  346. XREDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
  347. XINCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
  348. XOUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
  349. XTO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
  350. XYOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
  351. XPROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
  352. XPOSSIBILITY OF SUCH DAMAGES.
  353. X
  354. X             END OF TERMS AND CONDITIONS
  355. X
  356. X    Appendix: How to Apply These Terms to Your New Programs
  357. X
  358. X  If you develop a new program, and you want it to be of the greatest
  359. Xpossible use to the public, the best way to achieve this is to make it
  360. Xfree software which everyone can redistribute and change under these terms.
  361. X
  362. X  To do so, attach the following notices to the program.  It is safest
  363. Xto attach them to the start of each source file to most effectively
  364. Xconvey the exclusion of warranty; and each file should have at least
  365. Xthe "copyright" line and a pointer to where the full notice is found.
  366. X
  367. X    <one line to give the program's name and a brief idea of what it does.>
  368. X    Copyright (C) 19yy  <name of author>
  369. X
  370. X    This program is free software; you can redistribute it and/or modify
  371. X    it under the terms of the GNU General Public License as published by
  372. X    the Free Software Foundation; either version 2 of the License, or
  373. X    (at your option) any later version.
  374. X
  375. X    This program is distributed in the hope that it will be useful,
  376. X    but WITHOUT ANY WARRANTY; without even the implied warranty of
  377. X    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  378. X    GNU General Public License for more details.
  379. X
  380. X    You should have received a copy of the GNU General Public License
  381. X    along with this program; if not, write to the Free Software
  382. X    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  383. X
  384. XAlso add information on how to contact you by electronic and paper mail.
  385. X
  386. XIf the program is interactive, make it output a short notice like this
  387. Xwhen it starts in an interactive mode:
  388. X
  389. X    Gnomovision version 69, Copyright (C) 19yy name of author
  390. X    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
  391. X    This is free software, and you are welcome to redistribute it
  392. X    under certain conditions; type `show c' for details.
  393. X
  394. XThe hypothetical commands `show w' and `show c' should show the appropriate
  395. Xparts of the General Public License.  Of course, the commands you use may
  396. Xbe called something other than `show w' and `show c'; they could even be
  397. Xmouse-clicks or menu items--whatever suits your program.
  398. X
  399. XYou should also get your employer (if you work as a programmer) or your
  400. Xschool, if any, to sign a "copyright disclaimer" for the program, if
  401. Xnecessary.  Here is a sample; alter the names:
  402. X
  403. X  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
  404. X  `Gnomovision' (which makes passes at compilers) written by James Hacker.
  405. X
  406. X  <signature of Ty Coon>, 1 April 1989
  407. X  Ty Coon, President of Vice
  408. X
  409. XThis General Public License does not permit incorporating your program into
  410. Xproprietary programs.  If your program is a subroutine library, you may
  411. Xconsider it more useful to permit linking proprietary applications with the
  412. Xlibrary.  If this is what you want to do, use the GNU Library General
  413. XPublic License instead of this License.
  414. END_OF_FILE
  415.   if test 17982 -ne `wc -c <'sacdrt3.1/COPYING'`; then
  416.     echo shar: \"'sacdrt3.1/COPYING'\" unpacked with wrong size!
  417.   fi
  418.   # end of 'sacdrt3.1/COPYING'
  419. fi
  420. if test ! -d 'sacdrt3.1/man' ; then
  421.     echo shar: Creating directory \"'sacdrt3.1/man'\"
  422.     mkdir 'sacdrt3.1/man'
  423. fi
  424. if test -f 'sacdrt3.1/man/sacdrt.1' -a "${1}" != "-c" ; then 
  425.   echo shar: Will not clobber existing file \"'sacdrt3.1/man/sacdrt.1'\"
  426. else
  427.   echo shar: Extracting \"'sacdrt3.1/man/sacdrt.1'\" \(11826 characters\)
  428.   sed "s/^X//" >'sacdrt3.1/man/sacdrt.1' <<'END_OF_FILE'
  429. X.\" @(#)sacdrt.1 3.0 02/13/94
  430. X.\"
  431. X.TH SACDRT 1L "13 February 1994"
  432. X.UC 4
  433. X.SH NAME
  434. Xsacdrt \- Saguaro Astronomy Club Database Reader and Translator for SAC version 5.2 and version 6.0
  435. X.SH SYNOPSIS
  436. X.B sacdrt
  437. X[
  438. X.B -f database
  439. X] [
  440. X.B -o output_file
  441. X] [
  442. X.B -P printer
  443. X] [
  444. X.B -L maxlines
  445. X] [
  446. X.B -t
  447. X] [
  448. X.I -a|-p
  449. X] [
  450. X.B -O
  451. X] ...
  452. X.SH DESCRIPTION
  453. X.I Sacdrt
  454. Xreads the
  455. X.I SAC-Database
  456. Xversion 5.2 and version 6.0, parse the entries in it and print them interactive 
  457. Xto the screen. Objects could be printed (either to file or printer) and
  458. Xsearched.
  459. X.I Sacdrt
  460. Xwill test on the startup if a X-Server is running. Then the program will run in
  461. Xit's own X-Window, else it uses ncurses routines for screen-output (see 
  462. X.B -t 
  463. Xoption).
  464. X.br
  465. X.I Sacdrt
  466. Xwill try to parse and translate (to normal readable form) following:
  467. X.PP
  468. X.B Name
  469. Xis the object name and object number from an given catalog. Whitch catalog it is,
  470. X.I sacdrt
  471. Xyou will show in
  472. X.B Info.
  473. XSome objects are known by other catalogs. These designations you will show in
  474. X.B Other
  475. Xfield. This field is displayed (if exists) in clamps (...), in the same line like
  476. X.B Name.
  477. XIn
  478. X.B Type
  479. Xfield is the object type given, e.g. galaxy, open cluster ....
  480. X.B Constellation, Rektaszension,
  481. Xand
  482. X.B Declination
  483. Xshow you the position of the object.
  484. X.B Brightness
  485. Xdisplays the magnitude of the object. Many objects brightnesses are declared as
  486. X.I unknown.
  487. XThese objects hasn't a published magnitude. Also no magnitude hasn't
  488. X.I dark nebulae.
  489. XIn the fields
  490. X.B U2000
  491. Xand
  492. X.B Tirion
  493. Xare the charts in the Uranometria 2000.0 and Tirion Sky Atlas 2000.0 displayed. In
  494. X.B Brightest Star
  495. Xand
  496. X.B Number of Stars
  497. Xwill values be showed, when the object type is an
  498. X.I open cluster,
  499. Xso that the magnitude of the
  500. X.B brightest star
  501. Xand the
  502. X.B number of stars
  503. Xin this cluster are given.
  504. X.B Brightest Star
  505. Xalso given, when the object is a planetary nebula, so it has a central star.
  506. X.B Size
  507. Xfield of objects show you the size of it in minutes of arc (') or seconds of arc ('').
  508. XIs your
  509. X.I SAC-Database
  510. Xof version 6.0, there is a new field - called
  511. X.B Surface brightness.
  512. XThese values are given in the 
  513. X.I Reference Catalog of Galaxies 3.
  514. XOnly in database version 5.2 is the
  515. X.B Source
  516. Xfield contained. It will show from where the informations are. In
  517. X.B Classification
  518. Xseveral professional classification schemes are contained.
  519. X.B Description
  520. Xgives you visual description of the object. In
  521. X.B Notes
  522. Xare additional object information given, e.g. position angel.
  523. X.PP
  524. X.B ATTENTION! 
  525. X.I Sacdrt
  526. Xdon't guarantee for the 100% correctly translation. But we still working!
  527. X.PP
  528. X.I Sacdrt 
  529. Xaccepts the following command line options:
  530. X.TP 0.6i
  531. X.B -f databse
  532. Xuse 
  533. X.I database
  534. Xas input-file. This will overrule the input-file given in the environment 
  535. Xvariable
  536. X.B SACDRT_INPUT.
  537. X.I Database
  538. Xmust be the whole path, including the filename, e.g.: 
  539. X
  540. X/home/ftp/pub/astro/SAC.TXT or
  541. X
  542. X~ftp/pub/astro/SAC.TXT.
  543. X
  544. XThe default (instead of environment or command line) is 
  545. X.I SAC.TXT
  546. Xin the current working directory.
  547. X.TP 0.6i
  548. X.B -o output_file
  549. Xuse 
  550. X.I output_file 
  551. Xas destination when writing
  552. X.I marked objects
  553. Xto a file. This will overrule the
  554. X.I output_file
  555. Xgiven in the environment variable
  556. X.B SACDRT_OUTPUT.
  557. X.I Output_file
  558. Xmust be the whole path, including the filename, e.g:
  559. X
  560. X~hagenl/SAC.OUTPUT.
  561. X
  562. XThe default (instead of environment or command line) is
  563. X.I SAC.OUTPUT
  564. Xin the current working directory.
  565. X.TP 0.6i
  566. X.B -P printer
  567. Xuse 
  568. X.I printer
  569. Xwhen printing
  570. X.I marked objects
  571. Xinstead of the printer specified in the enviroment variable
  572. X.B PRINTER.
  573. XYou must have defined a printer (in the environment or in the command line), else
  574. X.I sacdrt
  575. Xwill terminate with an error message.
  576. X.TP 0.6i
  577. X.B -L maxlines
  578. Xdefines the maximum lines to be used for one page when printing.
  579. XThe default is
  580. X.B 65.
  581. X.TP 0.6i
  582. X.B -t
  583. XForce
  584. X.I sacdrt
  585. Xto run in term mode, instead of use it's own X-Window. This has of course only
  586. Xeffect if there is a X-Server running.
  587. X.TP 0.6i
  588. X.B -a
  589. XWhen invoked,
  590. X.I sacdrt
  591. Xwill not use
  592. X.I a2ps
  593. Xas filter for output for the printer. This is for line printers.
  594. X.I Sacdrt
  595. Xwill print with the folloing command:
  596. X
  597. X.B lpr sac_print -Pprinter.
  598. X.TP 0.6i
  599. X.B -p
  600. XForce
  601. X.I sacdrt
  602. Xto use
  603. X.I a2ps
  604. Xas filter for output for the printer. This is for postscript printer.
  605. X.I Sacdrt
  606. Xwill print with the folloing command:
  607. X
  608. X.B a2ps -p -nn -nh -ns sac_print | lpr -Pprinter.
  609. X.TP 0.6i
  610. X.B -h
  611. XPrint usage information.
  612. X.TP 0.6i
  613. X.B -O
  614. XWhen invoked,
  615. X.I sacdrt
  616. Xwill not use the included parsers. The output is then none parsed.
  617. XSee also
  618. X.I Key-Commands
  619. Xin
  620. X.I Main-Mode.
  621. X.SH USAGE
  622. X.PP
  623. XWhen started
  624. X.I sacdrt
  625. Xat first it will initialize the intern data structures. This will need few seconds,
  626. Xbut save a lot of time when searching or printing. After this, the first object
  627. Xin the database is printed to the screen. Please note that the
  628. X.I sacdrt
  629. Xwill
  630. X.I NOT 
  631. Xchange the orginal database.
  632. X.I Sacdrt 
  633. Xonly read and parse the entries in it.
  634. XNow you can move through the database,
  635. Xsearch for objects and mark objects (press 
  636. X.B h
  637. Xfor help on keys or commands). For further
  638. X.I keys
  639. Xsee 
  640. X.I Key-Commands
  641. Xin
  642. X.I Main-Mode
  643. Xor
  644. X.I Complex-Mode
  645. Xetc.
  646. X.PP
  647. XWhen the
  648. X.I sacdrt
  649. Xis started and the initialisation is completed you are in the
  650. X.I Main-Mode.
  651. X.PP
  652. XAll
  653. X.I Key-Commands
  654. Xare non-case sensitive. You can also use the upper-cases.
  655. X.PP
  656. XFollowing 
  657. X.I Key-Commands 
  658. Xare possible in the
  659. X.I Main-Mode:
  660. X.TP 0.5i
  661. X.B c
  662. XComplex Search Window (see below
  663. X.I Complex-Mode
  664. X)
  665. X.TP 0.5i
  666. X.B f
  667. XTurn Filter for
  668. X.I marked objects (on/off).
  669. XThis has only an effect when objects are marked. When the filter is 
  670. X.I on, 
  671. Xthe program will working only with these
  672. X.I marked objects. 
  673. XAll other objects are disabled.
  674. X.TP 0.5i
  675. X.B h
  676. XHelp window. All possible keys are quoted in it.
  677. X.TP 0.5i
  678. X.B i
  679. XInfo window. Short information about the writer of
  680. X.I sacdrt
  681. Xprogram and the main feedback E-Mail adress.
  682. X.TP 0.5i
  683. X.B m
  684. Xmark the current object. The object will be inserted in the
  685. X.I marked object list
  686. X(see 
  687. X.I Print-Mode
  688. X).
  689. X.TP 0.5i
  690. X.B o
  691. XTurn
  692. X.I Parse-Mode (on/off).
  693. XWhen the
  694. X.I Parse-Mode
  695. Xis
  696. X.I on
  697. Xall object entries will be translated to a normal, readable form. Otherwise not!
  698. X.TP 0.5i
  699. X.B p
  700. XSwitch to
  701. X.I Print-Mode
  702. X(see below 
  703. X.I Print-Mode
  704. X).
  705. X.TP 0.5i
  706. X.B q
  707. XQuit. Will terminate the
  708. X.I sacdrt
  709. Xprogram.
  710. X.TP 0.5i
  711. X.B s
  712. XSwitch to
  713. X.I Search-Mode
  714. X(see below
  715. X.I Search-Mode
  716. X).
  717. X.TP 0.5i
  718. X.B w
  719. XWrite commandline options to startup file
  720. X.I $HOME/.sacdrtrc
  721. X.PP
  722. XWith key 
  723. X.B s
  724. Xyou come to the
  725. X.I Search-Mode.
  726. XThe searching of
  727. X.I sacdrt
  728. Xis different from other programs. At first (that's not different of course) searching is non-case sensitive. At second (now come's the difference!) the search function will eleminate all blanks in the search string. This means that you can type one of the following to search, e.g for
  729. X.B Berk 59:
  730. X<berk 59>, <berk59>, <Berk 59>, <Berk59>, <BERK 59>, <BERK59>, <b e r k 5 9> or any other combination. For every input will be found the object
  731. X.B Berk 59
  732. X(Berkeley No.59).
  733. X.PP
  734. XWhen you use
  735. X.B p,
  736. Xyou will come to the
  737. X.I Print-Mode.
  738. XThis will only be possible, when you have previously marked some (more than 0) objects. A new window will be opened.
  739. X.PP
  740. XFollowing
  741. X.I Key-Commands
  742. Xare possible in the
  743. X.I Print-Mode:
  744. X.TP 0.5i
  745. X.B a
  746. Xdelete all object entries. The
  747. X.I marked object list
  748. Xis then destroyed and the
  749. X.I filter
  750. Xis turned
  751. X.I off.
  752. X.TP 0.5i
  753. X.B f
  754. Xwrite all
  755. X.I marked objects
  756. Xto given file (see enviroment variable
  757. X.I SACDRT_OUTPUT,
  758. Xcommandline or initfile).
  759. X.TP 0.5i
  760. X.B o
  761. Xdelete the current object.
  762. X.TP 0.5i
  763. X.B p
  764. Xprint all
  765. X.I marked objects
  766. Xto given printer (see enviroment variable
  767. X.I PRINTER,
  768. Xcommandline or initfile).
  769. X.TP 0.5i
  770. X.B q
  771. Xwill quit the
  772. X.I Print-Mode
  773. Xand return to
  774. X.I Main-Mode.
  775. XThe
  776. X.I marked objects
  777. Xwill
  778. X.I not 
  779. Xbe deleted.
  780. X.TP 0.5i
  781. X.B s
  782. XSwitch to
  783. X.I Sort-Mode
  784. X(see below
  785. X.I Sort-Mode
  786. X).
  787. X.TP 0.5i
  788. X.B Return/Space
  789. Xwill return to the
  790. X.I Main-Mode
  791. Xand show you the current object.
  792. X.PP
  793. XWith using
  794. X.B c
  795. Xyou will come to the
  796. X.I Complex-Mode.
  797. XIn this mode the
  798. X.I sacdrt
  799. Xenable you to select objects with definable conditions. E.g. you will select all Messier objects from magnitude 5.0m to 8.0m in a rektaszension between 12h00.0 and 18h34.0 and so one.
  800. X.I Sacdrt
  801. Xwill find all the objects whitch perform the conditions and mark these.
  802. X.PP
  803. X.B WARNING!
  804. XAn existing list of
  805. X.I marked objects
  806. Xwill be deleted when you start the search.
  807. XWhen
  808. X.I complex search
  809. Xis ready, the program returns to
  810. X.I Main-Mode
  811. Xand enable the
  812. X.I filter (on).
  813. XNow you can work with these new
  814. X.I marked object list,
  815. Xlike before with other lists (see
  816. X.I Print-Mode
  817. X).
  818. X.PP
  819. XFollowing
  820. X.I Key-Commands
  821. Xare possible in the
  822. X.I Complex-Mode:
  823. X.TP 0.5i
  824. X.B i
  825. Xswitch to invers marking
  826. X.TP 0.5i
  827. X.B h
  828. Xwill get you an own help window with the possibilities of
  829. X.I complex search.
  830. X.TP 0.5i
  831. X.B Return/m
  832. XMark/Unmark/Edit value.
  833. X.TP 0.5i
  834. X.B o
  835. XDefault values. Set all parameters to
  836. X.I default.
  837. X.TP 0.5i
  838. X.B q
  839. XTerminate input sequence and return to
  840. X.I Main-Mode 
  841. Xwithout searching and deleting an old
  842. X.I marked object list.
  843. X.TP 0.5i
  844. X.B s
  845. XStart search.
  846. X.PP
  847. XIn
  848. X.I Sort-Mode
  849. Xyou can sort a list of
  850. X.I marked objects
  851. Xto a specified criterion. These criterions are:
  852. X.br
  853. X.PP
  854. X.I Rektaszension 
  855. X(default)
  856. X.br
  857. X.I Deklination
  858. X.br
  859. X.I Magnitude
  860. X.br
  861. X.I Name
  862. X.br
  863. X.I Type
  864. X.br
  865. X.I Constellation
  866. X.PP
  867. XAlso it is possible to sort in
  868. X.I ascending
  869. X(default) or
  870. X.I descending
  871. Xdirection.
  872. X.PP
  873. XFollowing
  874. X.I Key-Commands
  875. Xare also possible in
  876. X.I Sort-Mode:
  877. X.TP 0.6i
  878. X.B q
  879. XQuit. Leave the
  880. X.I Sort-Mode
  881. Xand return (without sorting) to
  882. X.I Print-Mode.
  883. X.TP 0.6i
  884. X.B s
  885. XStart sort. After this, program returns to
  886. X.I Print-Mode.
  887. XThere you can work again with the
  888. X.I sorted marked object list.
  889. X.TP 0.6i
  890. X.B Return/Space
  891. Xactivate sort criterion.
  892. X.PP
  893. X.B Moving
  894. Xwith cursor-keys through the different modies are the same everywhere (nearly everywhere).
  895. X.TP 0.6i
  896. X.B Cursor up/down or u/d
  897. XIn
  898. X.I Main-Mode
  899. Xit will bring you to the
  900. X.I next/previous
  901. Xentry.
  902. X.br
  903. XIn 
  904. X.I Print-Mode
  905. Xand in
  906. X.I Complex-Mode
  907. X(only for Name/Type/Const) this will move the scollbar 
  908. X.I up/down.
  909. X.br
  910. XIn
  911. X.I Sort-Mode
  912. Xit moves to the
  913. X.I upper/lower
  914. Xcriterion.
  915. X.TP 0.6i
  916. X.B Cursor left/right or p/n
  917. XIn
  918. X.I Complex-Mode.
  919. XThis will bring you to the
  920. X.I next/previous
  921. Xitem for edit or mark.
  922. X.br
  923. XIn
  924. X.I Sort-Mode
  925. Xthis will bring to a righter/lefter position.
  926. X.TP 0.6i
  927. X.B PgUp/PgDn or +/-
  928. XWill move
  929. X.I +100/-100
  930. Xentries
  931. X.I forward/backward
  932. Xin
  933. X.I Main-Mode.
  934. XIn
  935. X.I Print-Mode
  936. Xand in
  937. X.I Complex-Mode
  938. X(only for Name/Type/Const) it will move the scrollbar
  939. X.I +10/-10
  940. Xitems
  941. X.I up/down.
  942. X.TP 0.6i
  943. X.B Home/End or b/e
  944. XIn
  945. X.I Main-Mode
  946. Xand in
  947. X.I Print-Mode
  948. Xit will bring you to the
  949. X.I last/first
  950. Xdatabase entry.
  951. X.SH FILES
  952. XInstead of commandline options or environment variables you can use a config
  953. Xfile. This will be
  954. X.I $HOME/.sacdrtrc
  955. XIn this file you can use the following entries:
  956. X.TP 0.6i
  957. X.B term=[on|off]
  958. XSame as 
  959. X.B -t
  960. Xin commandline.
  961. X.TP 0.6i
  962. X.B print_ascii=[on|off]
  963. XSame as
  964. X.B -a
  965. Xin commandline.
  966. X.TP 0.6i
  967. X.B print_ps=[on|off]
  968. XSame as
  969. X.B -p
  970. Xin commandline.
  971. X.TP 0.6i
  972. X.B output_file=outputfile
  973. XSame as
  974. X.B -o
  975. Xin commandline.
  976. X.TP 0.6i
  977. X.B inpute_file=inputfile
  978. XSame as
  979. X.B -f
  980. Xin commandline.
  981. X.TP 0.6i
  982. X.B printer=printer
  983. XSame as
  984. X.B -P
  985. Xin commandline.
  986. X.TP 0.6i
  987. X.B max_lines=maxlines
  988. XSame as
  989. X.B -L
  990. Xin commandline.
  991. X.PP
  992. X.SH "SEE ALSO"
  993. Xlpr(1) a2ps(1L)
  994. X.SH BUGS
  995. XBackspace for clearing wrong inputs in searching mode will not work (Try Crtl+h).
  996. X.br
  997. XX application will still not work.
  998. X.SH AUTHORS
  999. XLars Hagen (hagenl@cs.tu-berlin.de) idea, parser & man-page.
  1000. X.br
  1001. XSven van der Meer (vdmeer@cs.tu-berlin.de) data structures & term layout.
  1002. X.SH THANKS TO
  1003. XVery, very special thanks to Sven Mathing and Stefan Arbanowski for helps and the lot of very well ideas by theoretical problems solutions.
  1004. X.PP
  1005. XA special thanks to Steve Coe for a lot of help by the realisation of the parsers.
  1006. X.PP
  1007. XThanks to Carsten Borman for well new ideas.
  1008. X.PP
  1009. XAlso, thanks to all people for putting up with, reporting bugs in, and suggesting new additions to the old
  1010. X.I sacdrt.
  1011. END_OF_FILE
  1012.   if test 11826 -ne `wc -c <'sacdrt3.1/man/sacdrt.1'`; then
  1013.     echo shar: \"'sacdrt3.1/man/sacdrt.1'\" unpacked with wrong size!
  1014.   fi
  1015.   # end of 'sacdrt3.1/man/sacdrt.1'
  1016. fi
  1017. if test ! -d 'sacdrt3.1/sacdrt_term' ; then
  1018.     echo shar: Creating directory \"'sacdrt3.1/sacdrt_term'\"
  1019.     mkdir 'sacdrt3.1/sacdrt_term'
  1020. fi
  1021. if test -f 'sacdrt3.1/sacdrt_term/input.c' -a "${1}" != "-c" ; then 
  1022.   echo shar: Will not clobber existing file \"'sacdrt3.1/sacdrt_term/input.c'\"
  1023. else
  1024.   echo shar: Extracting \"'sacdrt3.1/sacdrt_term/input.c'\" \(12464 characters\)
  1025.   sed "s/^X//" >'sacdrt3.1/sacdrt_term/input.c' <<'END_OF_FILE'
  1026. X/*
  1027. X * SACDRT Version 3.1 SAC-Database-Reader for DeepSky Objects
  1028. X * Module INPUT.C is written by Sven van der Meer for the SACDRT.
  1029. X *
  1030. X *  Copyright (C) 1994 Lars Hagen & Sven van der Meer
  1031. X *
  1032. X *  This program is free software; you can redistribute it and/or modify
  1033. X *  it under the terms of the GNU General Public License as published by
  1034. X *  the Free Software Foundation; either version 2 of the License, or
  1035. X *  (at your option) any later version.
  1036. X *
  1037. X *  This program is distributed in the hope that it will be useful,
  1038. X *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  1039. X *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  1040. X *  GNU General Public License for more details.
  1041. X *
  1042. X *  You should have received a copy of the GNU General Public License
  1043. X *  along with this program; if not, write to the Free Software
  1044. X *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  1045. X *
  1046. X *  Problems or comments to hagenl@cs.tu-berlin.de
  1047. X *
  1048. X */
  1049. X
  1050. X#include <string.h>
  1051. X#include <stdlib.h>
  1052. X#include "sacdrt.h"
  1053. X#include "database.h"
  1054. X#include "layout.h"
  1055. X
  1056. X
  1057. XFILE *file_ptr;                 /* pointer to the input file  */
  1058. Xvoid insert_sac(char *,int);
  1059. Xvoid delete_waste(char *,char *);
  1060. X
  1061. X
  1062. X/*
  1063. X *  int INPUT(int, int) input works for all other function, which need
  1064. X *                      parsed information from the database.
  1065. X *                      NEW_CURRENT indicates the new offset, if there it is
  1066. X *                      new needed (searching and printing will call this)
  1067. X *                      TO_DO tells input what todo. see the switch for
  1068. X *                      possible calls
  1069. X *
  1070. X */
  1071. Xint input(int new_current, int to_do)
  1072. X{
  1073. Xstatic char name[80], name_info[80], other[80], type[80], con[80], ra[10],
  1074. X      dec[10], mag[80], u2000[30], tirion[30], descr[500], size[20],
  1075. X      clas[200], nsts[20], brstr[10], notes[200], source[100], subr[5];
  1076. X
  1077. Xint i=0, j=0, ret=TRUE;
  1078. Xchar *tmp_ptr;
  1079. Xchar help_ptr[MAXPATHLEN];
  1080. Xstruct core_list *sac_core=&head_core;
  1081. Xstruct mark_list *tmp_mark=&head_mark;
  1082. Xchar c;
  1083. X
  1084. X switch(to_do){
  1085. X   case output_first:         sac_core=sac_core->next;
  1086. X                 status.core_current=sac_core->core_count;
  1087. X                         break;
  1088. X   case output_next:          if(!config.filter){
  1089. X                               if (status.core_current+new_current<status.max_core)
  1090. X                                 i=status.core_current+new_current;
  1091. X                               else
  1092. X                                 i=status.max_core;
  1093. X                             }
  1094. X                             else{
  1095. X                               if (status.mark_current+new_current<status.max_mark-1)
  1096. X                                 i=status.mark_current+new_current;
  1097. X                               else
  1098. X                                 i=status.max_mark-1;
  1099. X                   while (tmp_mark->mark_count!=i)
  1100. X                 tmp_mark=tmp_mark->next_mark;
  1101. X                   i=tmp_mark->mark_core;
  1102. X                   status.mark_current=tmp_mark->mark_count;
  1103. X                             }
  1104. X                             while (sac_core->core_count!=i)
  1105. X                               sac_core=sac_core->next;
  1106. X                             status.core_current=sac_core->core_count;
  1107. X                             break;
  1108. X   case output_prev:         if(!config.filter){
  1109. X                               if (status.core_current-new_current>0)
  1110. X                             i=status.core_current-new_current;
  1111. X                    else
  1112. X                     i=1;
  1113. X                             }
  1114. X                             else{
  1115. X                               if (status.mark_current-new_current>0)
  1116. X                                 i=status.mark_current-new_current;
  1117. X                               else
  1118. X                                 i=1;
  1119. X                               while (tmp_mark->mark_count!=i)
  1120. X                                 tmp_mark=tmp_mark->next_mark;
  1121. X                               i=tmp_mark->mark_core;
  1122. X                               status.mark_current=tmp_mark->mark_count;
  1123. X                             }
  1124. X                 while (sac_core->core_count!=i)
  1125. X                               sac_core=sac_core->next;
  1126. X                             status.core_current=sac_core->core_count;
  1127. X                             break;
  1128. X   case file_current:
  1129. X   case print_current:       sac_core=status.next_core;
  1130. X                             break;
  1131. X   case search_found:        while (sac_core->core_count!=new_current)
  1132. X                               sac_core=sac_core->next;
  1133. X                             status.core_current=sac_core->core_count;
  1134. X                 break;
  1135. X   default:                  break;
  1136. X }
  1137. X status.next_core=sac_core;
  1138. X
  1139. X i=0;
  1140. X tmp_ptr=sac_core->sac_line;
  1141. X
  1142. X while(i<16){
  1143. X   c=*tmp_ptr++;
  1144. X   if (c=='"'||c=='\0'||c==0x0a||c==0x0d){
  1145. X     help_ptr[j++]='\0';
  1146. X     if(config.base_version==v52){
  1147. X       switch(i){
  1148. X         case  0: strcpy((char *)name,(const char *)help_ptr);
  1149. X                  break;
  1150. X         case  1: strcpy((char *)other,(const char *)help_ptr);
  1151. X                  break;
  1152. X         case  2: strcpy((char *)type,(const char *)help_ptr);
  1153. X                  break;
  1154. X         case  3: strcpy((char *)con,(const char *)help_ptr);
  1155. X                  break;
  1156. X         case  4: strcpy((char *)ra,(const char *)help_ptr);
  1157. X                  break;
  1158. X         case  5: strcpy((char *)dec,(const char *)help_ptr);
  1159. X                  break;
  1160. X         case  6: strcpy((char *)mag,(const char *)help_ptr);
  1161. X                  break;
  1162. X         case  7: strcpy((char *)u2000,(const char *)help_ptr);
  1163. X                  break;
  1164. X         case  8: strcpy((char *)tirion,(const char *)help_ptr);
  1165. X                  break;
  1166. X         case  9: strcpy((char *)descr,(const char *)help_ptr);
  1167. X                  break;
  1168. X         case 10: strcpy((char *)size,(const char *)help_ptr);
  1169. X                  break;
  1170. X         case 11: strcpy((char *)clas,(const char *)help_ptr);
  1171. X                  break;
  1172. X         case 12: strcpy((char *)nsts,(const char *)help_ptr);
  1173. X                  break;
  1174. X         case 13: strcpy((char *)brstr,(const char *)help_ptr);
  1175. X                  break;
  1176. X         case 14: strcpy((char *)notes,(const char *)help_ptr);
  1177. X                  break;
  1178. X         case 15: strcpy((char *)source,(const char *)help_ptr);
  1179. X                  break;
  1180. X       }
  1181. X     }
  1182. X     else{
  1183. X       switch(i){
  1184. X         case  0: strcpy((char *)name,(const char *)help_ptr);
  1185. X                  break;
  1186. X         case  1: strcpy((char *)other,(const char *)help_ptr);
  1187. X                  break;
  1188. X         case  2: strcpy((char *)type,(const char *)help_ptr);
  1189. X                  break;
  1190. X         case  3: strcpy((char *)con,(const char *)help_ptr);
  1191. X                  break;
  1192. X         case  4: strcpy((char *)ra,(const char *)help_ptr);
  1193. X                  break;
  1194. X         case  5: strcpy((char *)dec,(const char *)help_ptr);
  1195. X                  break;
  1196. X         case  6: strcpy((char *)mag,(const char *)help_ptr);
  1197. X                  break;
  1198. X         case  7: strcpy((char *)subr,(const char *)help_ptr);
  1199. X                  break;
  1200. X         case  8: strcpy((char *)u2000,(const char *)help_ptr);
  1201. X                  break;
  1202. X         case  9: strcpy((char *)tirion,(const char *)help_ptr);
  1203. X                  break;
  1204. X         case 10: strcpy((char *)descr,(const char *)help_ptr);
  1205. X                  break;
  1206. X         case 11: strcpy((char *)size,(const char *)help_ptr);
  1207. X                  break;
  1208. X         case 12: strcpy((char *)clas,(const char *)help_ptr);
  1209. X                  break;
  1210. X         case 13: strcpy((char *)nsts,(const char *)help_ptr);
  1211. X                  break;
  1212. X         case 14: strcpy((char *)brstr,(const char *)help_ptr);
  1213. X                  break;
  1214. X         case 15: strcpy((char *)notes,(const char *)help_ptr);
  1215. X                  break;
  1216. X       }
  1217. X     }
  1218. X     i++; j=0;
  1219. X   }
  1220. X   else{
  1221. X     help_ptr[j++]=c;
  1222. X   }
  1223. X } 
  1224. X
  1225. X parse_name(name_info, name);
  1226. X if (config.parse){
  1227. X   parse_type(type); 
  1228. X   parse_con(con); 
  1229. X   parse_ra (ra);
  1230. X   parse_dec(dec);
  1231. X   parse_mag(mag,FALSE);
  1232. X   parse_class(clas);
  1233. X   parse_descr(descr);
  1234. X   parse_brstr(brstr);
  1235. X   parse_nsts(nsts);
  1236. X   parse_notes(notes);
  1237. X   parse_size(size);
  1238. X   if(config.base_version==v52)
  1239. X     parse_source(source);
  1240. X   if(config.base_version==v6)
  1241. X     parse_mag(subr,TRUE);
  1242. X }
  1243. X
  1244. X if ((to_do==output_first) || (to_do==output_next) || 
  1245. X     (to_do==output_prev)  || (to_do==search_found)){
  1246. X   output(name, name_info, other, type, con,
  1247. X          ra, dec, mag, u2000, tirion,
  1248. X          descr, size, clas, nsts,
  1249. X          brstr, notes, source, subr);
  1250. X }
  1251. X
  1252. X if (to_do==print_current){
  1253. X   print_page(name, name_info, other, type, con,
  1254. X              ra, dec, mag, u2000, tirion,
  1255. X              descr, size, clas, nsts,
  1256. X              brstr, notes, source, subr, print_current);
  1257. X }
  1258. X
  1259. X if (to_do==file_current){
  1260. X   print_page(name, name_info, other, type, con,
  1261. X              ra, dec, mag, u2000, tirion,
  1262. X              descr, size, clas, nsts,
  1263. X              brstr, notes, source, subr, file_current);
  1264. X }
  1265. Xreturn ret;
  1266. X}
  1267. X
  1268. X
  1269. X
  1270. X/*
  1271. X * void SAC_END()  is called from main when the user wants to leave the program
  1272. X *                 close the files, end curses end then exit 0
  1273. X *
  1274. X */ 
  1275. Xvoid sac_end()
  1276. X{
  1277. X message_window("   Cleaning up",normal);
  1278. X delete_all_marked();
  1279. X delete_core_list();
  1280. X if(config.rc_input!=NULL)   free(config.rc_input);
  1281. X if(config.rc_output!=NULL)  free(config.rc_output);
  1282. X if(config.rc_printer!=NULL) free(config.rc_printer);
  1283. X free(status.time);
  1284. X close_message_window(normal);
  1285. X close_layout();
  1286. X ending_message();
  1287. X exit (0);
  1288. X}
  1289. X
  1290. X
  1291. X
  1292. X/*
  1293. X * void OPEN_FILE()  opens the input file for function input(..). at first
  1294. X *                   the file given from the init file will be used, then
  1295. X *                   the file given from command-line will be used, then
  1296. X *                   the file specified in the environment SACBASE_INPUT
  1297. X *                   and at last the file SAC.TXT in the current working
  1298. X *                   directory. When there are errors, a aproporiate message
  1299. X *                   will be printed to stderr and the sacdrt terminates
  1300. X *
  1301. X */
  1302. Xvoid open_file()
  1303. X{
  1304. Xchar *enviroment=NULL;
  1305. X
  1306. X if (config.input!=NULL)
  1307. X   file_ptr = fopen(config.input, "r");
  1308. X else if (config.rc_input!=NULL)
  1309. X   file_ptr = fopen(config.rc_input, "r");
  1310. X else if ((enviroment = getenv(SAC_DEFAULT_ENV_INPUT)) != NULL)
  1311. X   file_ptr = fopen(enviroment, "r");
  1312. X else
  1313. X   file_ptr = fopen(SAC_DEFAULT_INPUT, "r");
  1314. X  
  1315. X if (!file_ptr){
  1316. X   fprintf(stderr,"sac: unable to open file -> ");
  1317. X   if (config.input!=NULL)
  1318. X     fprintf(stderr,"%s given from command-line\n",config.input);
  1319. X   if (config.rc_input!=NULL)
  1320. X     fprintf(stderr,"%s given from .sacdrt file\n",config.rc_input);
  1321. X   else if (enviroment!=NULL)
  1322. X     fprintf(stderr,"%s given from environment\n",enviroment);
  1323. X   else
  1324. X     fprintf(stderr,"%s no such file in current directory\n",SAC_DEFAULT_INPUT);
  1325. X   exit (1);
  1326. X }
  1327. X if (getc(file_ptr)=='"')
  1328. X   config.base_version=v6;
  1329. X else
  1330. X   config.base_version=v52;
  1331. X fseek(file_ptr,0,SEEK_SET);
  1332. Xreturn;
  1333. X}
  1334. X
  1335. X
  1336. X
  1337. X/*
  1338. X * void INITIALIZE()       when a file opened, this function will build the
  1339. X *               structure core_list.
  1340. X *               Every entry in core_list is one line from the 
  1341. X *               database. So we have the whole database as core
  1342. X *               in the memory (this saves a lot of time when 
  1343. X *               searching, but needs about 2meg for running the
  1344. X *               sacdrt).
  1345. X *
  1346. X */
  1347. Xvoid initialize()
  1348. X{
  1349. Xchar *tmp_ptr=(char *)malloc(MAXPATHLEN); 
  1350. Xint i=0;
  1351. X
  1352. X head_core.mark_flag=FALSE;
  1353. X while(fgets(tmp_ptr,MAXPATHLEN,file_ptr)&&++i)
  1354. X   insert_sac(tmp_ptr,i);
  1355. X
  1356. X status.max_core=i;
  1357. X
  1358. X free(tmp_ptr);
  1359. X fclose(file_ptr);
  1360. Xreturn;
  1361. X}
  1362. X
  1363. X
  1364. X
  1365. X/*
  1366. X *  void INSERT_SAC(char*,int)  called from initialize to insert the new object
  1367. X *                              in the existing list
  1368. X *                              DELETE_WASTE is used to delete '",' from
  1369. X *                              version 6.
  1370. X *
  1371. X */
  1372. Xvoid insert_sac(char *tmp_ptr,int count)
  1373. X{
  1374. Xstruct core_list *tmp_core;
  1375. Xchar *tmp_line;
  1376. X
  1377. X tmp_core=(struct core_list *)malloc(sizeof(struct core_list));
  1378. X tmp_line=(char *)malloc(strlen(tmp_ptr)+1);
  1379. X delete_waste(tmp_line,tmp_ptr);
  1380. X
  1381. X tmp_core->sac_line=(char *)malloc(strlen(tmp_line)+1);
  1382. X  if (tmp_core==NULL)
  1383. X   sac_exit(7," in function insert_sac");
  1384. X strcpy((char *)tmp_core->sac_line,(const char *)tmp_line);
  1385. X
  1386. X tmp_core->core_count=count;
  1387. X tmp_core->mark_flag=FALSE;
  1388. X
  1389. X tail_core.next->next=tmp_core;
  1390. X tmp_core->next=&tail_core;
  1391. X tail_core.next=tmp_core;
  1392. X
  1393. X free(tmp_line);
  1394. Xreturn;
  1395. X}
  1396. X
  1397. X
  1398. X
  1399. Xvoid delete_waste(char *ptr1,char *ptr2)
  1400. X{
  1401. X if(config.base_version==v6)
  1402. X   ptr2++;
  1403. X while (*ptr2!='\0'){
  1404. X   if(*ptr2=='"'){
  1405. X     ptr2++;
  1406. X     if(*ptr2==',')
  1407. X       ptr2++;
  1408. X     else
  1409. X       ptr2--;
  1410. X   }
  1411. X   *ptr1++=*ptr2++;
  1412. X }
  1413. Xreturn;
  1414. X}
  1415. END_OF_FILE
  1416.   if test 12464 -ne `wc -c <'sacdrt3.1/sacdrt_term/input.c'`; then
  1417.     echo shar: \"'sacdrt3.1/sacdrt_term/input.c'\" unpacked with wrong size!
  1418.   fi
  1419.   # end of 'sacdrt3.1/sacdrt_term/input.c'
  1420. fi
  1421. if test -f 'sacdrt3.1/sacdrt_term/mark_objects.c' -a "${1}" != "-c" ; then 
  1422.   echo shar: Will not clobber existing file \"'sacdrt3.1/sacdrt_term/mark_objects.c'\"
  1423. else
  1424.   echo shar: Extracting \"'sacdrt3.1/sacdrt_term/mark_objects.c'\" \(14528 characters\)
  1425.   sed "s/^X//" >'sacdrt3.1/sacdrt_term/mark_objects.c' <<'END_OF_FILE'
  1426. X/*
  1427. X * SACDRT Version 3.1 SAC-Database-Reader for DeepSky Objects
  1428. X * Module MARKED_OBJECTS.C is written by Sven van der Meer for SACDRT.
  1429. X *
  1430. X *  Copyright (C) 1994 Lars Hagen & Sven van der Meer
  1431. X *
  1432. X *  This program is free software; you can redistribute it and/or modify
  1433. X *  it under the terms of the GNU General Public License as published by
  1434. X *  the Free Software Foundation; either version 2 of the License, or
  1435. X *  (at your option) any later version.
  1436. X *
  1437. X *  This program is distributed in the hope that it will be useful,
  1438. X *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  1439. X *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  1440. X *  GNU General Public License for more details.
  1441. X *
  1442. X *  You should have received a copy of the GNU General Public License
  1443. X *  along with this program; if not, write to the Free Software
  1444. X *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  1445. X *
  1446. X *  Problems or comments to hagenl@cs.tu-berlin.de
  1447. X *
  1448. X */
  1449. X
  1450. X#include <string.h>
  1451. X#include <stdlib.h>
  1452. X#include <ctype.h>
  1453. X#include <math.h>
  1454. X#include "database.h"
  1455. X#include "sacdrt.h"
  1456. X#include "layout.h"
  1457. X
  1458. X
  1459. Xvoid sacdrt_qsort(struct core_list *v[],int,int);
  1460. Xvoid sacdrt_swap(struct core_list *v[],int,int);
  1461. Xint  sacdrt_cmp(struct core_list *,struct core_list *);
  1462. Xvoid sacdrt_shell(struct core_list *v[],int);
  1463. X
  1464. X/*
  1465. X * void INSERT_MARKED (int)  will insert a marked object in the marked list
  1466. X *                 using status.next_core
  1467. X *
  1468. X */
  1469. Xvoid insert_marked(int todo)
  1470. X{
  1471. Xstruct core_list *sac_core=&head_core;
  1472. Xstruct mark_list *tmp_mark;
  1473. Xchar tmp_ptr[MAXPATHLEN];
  1474. X
  1475. X tmp_mark=(struct mark_list *)malloc(sizeof(struct mark_list));
  1476. X if (tmp_mark==NULL)
  1477. X   sac_exit(7," in function insert_object");
  1478. X
  1479. X sac_core=status.next_core;
  1480. X
  1481. X sac_core->mark_flag=todo;
  1482. X switch(todo){
  1483. X   case use_name:  strcpy((char *)tmp_ptr,(const char *)(parse_core(sac_core->sac_line,8)));
  1484. X           break;
  1485. X   case use_other: strcpy((char *)tmp_ptr,(const char *)(parse_core(sac_core->sac_line,9)));
  1486. X                   break;
  1487. X }
  1488. X tmp_mark->mark_name=(char *)malloc(strlen(tmp_ptr)+1);
  1489. X strcpy((char *)tmp_mark->mark_name,tmp_ptr);
  1490. X tmp_mark->mark_core=sac_core->core_count;
  1491. X tmp_mark->mark_count=status.max_mark;
  1492. X tmp_mark->next_core=sac_core;
  1493. X
  1494. X tail_mark.next_mark->next_mark=tmp_mark;
  1495. X tmp_mark->next_mark=&tail_mark;
  1496. X tail_mark.next_mark=tmp_mark;
  1497. X
  1498. X status.max_mark++;
  1499. Xreturn;
  1500. X}
  1501. X
  1502. X
  1503. X
  1504. X/*
  1505. X *  void DELETE_ONE_MARKED (int) delete one marked object from the marked list
  1506. X *                               called from show_marked (layout.c) with the
  1507. X *                               count from the object to delete
  1508. X *
  1509. X */
  1510. Xvoid delete_one_marked(int delete)
  1511. X{
  1512. Xstruct mark_list *tmp_mark=&head_mark;
  1513. Xstruct mark_list *del=&head_mark;
  1514. Xstruct core_list *fil=&head_core;
  1515. Xint i;
  1516. X
  1517. X while((delete!=del->mark_count)&&(del!=&tail_mark))
  1518. X   del=del->next_mark;
  1519. X
  1520. X while((tmp_mark!=&tail_mark)&&(tmp_mark->next_mark!=del))
  1521. X   tmp_mark=tmp_mark->next_mark;
  1522. X
  1523. X if (tmp_mark->next_mark!=del)
  1524. X   return;
  1525. X
  1526. X tmp_mark->next_mark=del->next_mark;
  1527. X while (fil->core_count!=del->mark_core)
  1528. X   fil=fil->next;
  1529. X fil->mark_flag=FALSE;
  1530. X free(del->mark_name);
  1531. X free(del);
  1532. X status.max_mark--;
  1533. X if (status.max_mark<2){
  1534. X   status.max_mark=1;
  1535. X   sac_filter(OFF);
  1536. X   head_mark.next_mark=&tail_mark;
  1537. X   tail_mark.next_mark=&head_mark;
  1538. X }
  1539. X else{
  1540. X   tmp_mark=head_mark.next_mark;
  1541. X   for(i=1;tmp_mark!=&tail_mark;i++){
  1542. X     tmp_mark->mark_count=i;
  1543. X     tmp_mark=tmp_mark->next_mark;
  1544. X   }
  1545. X   status.max_mark=i;
  1546. X }
  1547. X
  1548. Xreturn;
  1549. X}
  1550. X
  1551. X
  1552. X/*
  1553. X *  void DELETE_ALL_MARKED()  will delete all marked objects and free up the
  1554. X *                            memory allocated for the marked list
  1555. X *
  1556. X */
  1557. Xvoid delete_all_marked()
  1558. X{
  1559. Xstruct mark_list *tmp_mark;
  1560. Xstruct mark_list *tmp_swap;
  1561. Xstruct core_list *tmp_core=&head_core;
  1562. X
  1563. X for (tmp_mark=head_mark.next_mark;tmp_mark!=&tail_mark;tmp_mark=tmp_swap){
  1564. X   tmp_swap=tmp_mark->next_mark;
  1565. X   free(tmp_mark->mark_name);
  1566. X   free(tmp_mark);
  1567. X }
  1568. X head_mark.next_mark=&tail_mark;
  1569. X tail_mark.next_mark=&head_mark;
  1570. X
  1571. X if(tmp_core!=&tail_core){
  1572. X   while((tmp_core=tmp_core->next)!=&tail_core)
  1573. X     tmp_core->mark_flag=FALSE;
  1574. X }
  1575. X
  1576. X status.max_mark=1;
  1577. X sac_filter(OFF);
  1578. Xreturn;
  1579. X}
  1580. X
  1581. X
  1582. X
  1583. X/*
  1584. X *  void DELETE_CORE_LIST()  free up all allocated memory for the core list
  1585. X *                   and delete the core list. called when sacdrt
  1586. X *                 terminates
  1587. X *
  1588. X */
  1589. Xvoid delete_core_list()
  1590. X{
  1591. Xstruct core_list *tmp_core;
  1592. Xstruct core_list *tmp_swap;
  1593. X
  1594. X for (tmp_core=head_core.next;tmp_core!=&tail_core;tmp_core=tmp_swap){
  1595. X   tmp_swap=tmp_core->next;
  1596. X   free(tmp_core->sac_line);
  1597. X   free(tmp_core);
  1598. X }
  1599. X
  1600. Xreturn;
  1601. X}
  1602. X
  1603. X
  1604. X
  1605. X/* 
  1606. X * int CS_DO_SEARCH(int)  called from cs_search to search for the requested
  1607. X *                        objects. i hope this will not need a lot of time
  1608. X *                        (on my computer about 10 seconds for all marked).
  1609. X *
  1610. X */
  1611. Xint cs_do_search()
  1612. X{
  1613. Xint ret=FALSE,i,test,cs_count=1;
  1614. Xdouble mag_db,ra_db,decl_db;
  1615. Xdouble min_mag_cmp,max_mag_cmp,min_ra_cmp,max_ra_cmp,min_decl_cmp,max_decl_cmp;
  1616. Xdouble min_mag_default,max_mag_default;
  1617. Xstruct core_list *sac_core=&head_core;
  1618. Xchar tmp[10];
  1619. X
  1620. X min_mag_cmp=atof(cs_values.min_mag)-0.1;
  1621. X max_mag_cmp=atof(cs_values.max_mag)+0.1;
  1622. X min_ra_cmp=atof(cs_values.min_ra)-0.1;
  1623. X max_ra_cmp=atof(cs_values.max_ra)+0.1;
  1624. X min_decl_cmp=atof(cs_values.min_decl)-0.1;
  1625. X max_decl_cmp=atof(cs_values.max_decl)+0.1;
  1626. X
  1627. X min_mag_default=atof(CS_MIN_MAG);
  1628. X max_mag_default=atof(CS_MAX_MAG);
  1629. X
  1630. X delete_all_marked();
  1631. X sac_core=sac_core->next;
  1632. X
  1633. X while(sac_core!=&tail_core){
  1634. X   if((config.curses)&&(fmod((double)cs_count,(double)100)==0)){
  1635. X     mvwprintw(message_win,1,13,"%i",cs_count);
  1636. X     wrefresh(message_win);
  1637. X   }
  1638. X
  1639. X   strcpy((char *)cs_tmp.tmp_ptr,(const char *)sac_core->sac_line);
  1640. X
  1641. X   strcpy(tmp,parse_core(cs_tmp.tmp_ptr,6));
  1642. X   mag_db=atof(tmp);
  1643. X   strcpy(tmp,parse_core(cs_tmp.tmp_ptr,4));
  1644. X   ra_db=atof(tmp);
  1645. X   strcpy(tmp,parse_core(cs_tmp.tmp_ptr,5));
  1646. X   decl_db=atof(tmp);
  1647. X
  1648. X   strcpy((char *)cs_tmp.name_ptr,(const char *)parse_core(cs_tmp.tmp_ptr,0));
  1649. X   strcpy((char *)cs_tmp.type_ptr,(const char *)parse_core(cs_tmp.tmp_ptr,2));
  1650. X   strcpy((char *)cs_tmp.con_ptr,(const char *)parse_core(cs_tmp.tmp_ptr,3));
  1651. X   strcpy((char *)cs_tmp.other_ptr,(const char *)parse_core(cs_tmp.tmp_ptr,1));
  1652. X
  1653. X   if((min_mag_cmp==min_mag_default)&&(max_mag_cmp==max_mag_default))
  1654. X     sac_core->mark_flag=use_name;
  1655. X   else{
  1656. X     if((mag_db<max_mag_cmp)&&(mag_db>min_mag_cmp))
  1657. X       sac_core->mark_flag=use_name;
  1658. X     else
  1659. X       sac_core->mark_flag=FALSE;
  1660. X   }
  1661. X
  1662. X   if((ra_db<max_ra_cmp)&&(ra_db>min_ra_cmp)&&(sac_core->mark_flag))
  1663. X     sac_core->mark_flag=use_name;
  1664. X   else
  1665. X     sac_core->mark_flag=FALSE;
  1666. X
  1667. X   if((decl_db<max_decl_cmp)&&(decl_db>min_decl_cmp)&&(sac_core->mark_flag))
  1668. X     sac_core->mark_flag=use_name;
  1669. X   else
  1670. X     sac_core->mark_flag=FALSE;
  1671. X
  1672. X   test=FALSE;
  1673. X   if ((cs_values.mark_name)&&(sac_core->mark_flag)){
  1674. X     for (i=1;i<max_name;i++){
  1675. X       if((object_data[i].marked)&&(strcmp(cs_tmp.name_ptr,object_data[i].short_name)==0))
  1676. X         test=use_name;
  1677. X       else if((object_data[i].marked)&&(strcmp(cs_tmp.other_ptr,object_data[i].short_name)==0))
  1678. X         test=use_other;
  1679. X       else if((object_data[i].marked)&&(strcmp(object_data[i].short_name,"M1")==0)&&(strcmp(cs_tmp.other_ptr,"M1")==0))
  1680. X         test=use_other;
  1681. X       else if((object_data[i].marked)&&(strcmp(object_data[i].short_name,"M1")==0)&&(strcmp(cs_tmp.name_ptr,"M1")==0))
  1682. X         test=use_other;
  1683. X       if(test)
  1684. X         break;
  1685. X     }
  1686. X     sac_core->mark_flag=test;
  1687. X   }
  1688. X
  1689. X   test=FALSE;
  1690. X   if ((cs_values.mark_type)&&(sac_core->mark_flag)){
  1691. X     for (i=1;i<max_type;i++){
  1692. X       if((type_data[i].marked)&&(strcmp(cs_tmp.type_ptr,type_data[i].short_type)==0)){
  1693. X         test=sac_core->mark_flag;
  1694. X         break;
  1695. X       }
  1696. X     }
  1697. X     sac_core->mark_flag=test;
  1698. X   }
  1699. X
  1700. X   test=FALSE;
  1701. X   if ((cs_values.mark_con)&&(sac_core->mark_flag)){
  1702. X     for (i=1;i<max_con;i++){
  1703. X       if((const_data[i].marked)&&(strcmp(cs_tmp.con_ptr,const_data[i].short_con)==0)){
  1704. X         test=sac_core->mark_flag;
  1705. X         break;
  1706. X       }
  1707. X     }
  1708. X     sac_core->mark_flag=test;
  1709. X   }
  1710. X
  1711. X   if (sac_core->mark_flag){
  1712. X     status.next_core=sac_core;
  1713. X     insert_marked(sac_core->mark_flag);
  1714. X   }
  1715. X   sac_core=sac_core->next;
  1716. X   cs_count++;
  1717. X }
  1718. X if (status.max_mark==1)
  1719. X   ret=FALSE;
  1720. X else{
  1721. X   sac_filter(ON);
  1722. X   ret=TRUE;
  1723. X }
  1724. Xreturn ret;
  1725. X}
  1726. X
  1727. X
  1728. X
  1729. X/* 
  1730. X *  char *PARSE_CORE(char *,int)  input is sac_line and this function will
  1731. X *                                return the reqeusted value (name,type,const,
  1732. X *                                decl,mag,ra or other). to save time, the
  1733. X *                  returned pointers will be not parsed
  1734. X *
  1735. X */
  1736. Xchar *parse_core(char *tmp_ptr,int ret)
  1737. X{
  1738. Xchar return_ptr[80];
  1739. Xint i=0,j=0;
  1740. Xchar help_ptr[MAXPATHLEN];
  1741. Xchar c;
  1742. X
  1743. X while(i<7){
  1744. X   c=*tmp_ptr++;
  1745. X   if (c=='"'||c=='\0'){
  1746. X     help_ptr[j++]='\0';
  1747. X     if (i==ret){
  1748. X       strcpy((char *)return_ptr,(const char *)help_ptr);
  1749. X       break;
  1750. X     }
  1751. X     if ((ret==8)&&(i==0)){
  1752. X       strcpy((char *)return_ptr,(const char *)help_ptr);
  1753. X       break;
  1754. X     }
  1755. X     if ((ret==9)&&(i==1)){
  1756. X       strcpy((char *)return_ptr,(const char *)help_ptr);
  1757. X       break;
  1758. X     }
  1759. X     i++; j=0;
  1760. X   }
  1761. X   else{
  1762. X     help_ptr[j++]=c;
  1763. X   }
  1764. X }
  1765. X
  1766. X if(ret==0){
  1767. X   if((return_ptr[0]=='M')&&(return_ptr[2]=='-'))
  1768. X     return "M1";
  1769. X   else
  1770. X     i=0;
  1771. X   while(return_ptr[i]!='\0'){
  1772. X     if((!isspace(return_ptr[i]))&&!(isdigit(return_ptr[i]))&&(return_ptr[i]!='\''))
  1773. X         i++;
  1774. X     else{
  1775. X       return_ptr[i]='\0';
  1776. X       break;
  1777. X     }
  1778. X   }
  1779. X }
  1780. X if(ret==1){
  1781. X   if((return_ptr[0]=='M')&&(return_ptr[2]=='-'))
  1782. X     return "M1";
  1783. X   else
  1784. X   i=0;
  1785. X   while(return_ptr[i]!='\0'){
  1786. X     if(!isspace(return_ptr[i]))
  1787. X       i++;
  1788. X     else{
  1789. X       return_ptr[i]='\0';
  1790. X       break;
  1791. X     }
  1792. X   }
  1793. X }
  1794. Xreturn return_ptr;
  1795. X}
  1796. X
  1797. X
  1798. X
  1799. X/*
  1800. X *
  1801. X *
  1802. X *
  1803. X */
  1804. Xvoid sort_marked()
  1805. X{
  1806. Xint i=0,n=status.max_mark;
  1807. Xstruct mark_list *test_mark=head_mark.next_mark;
  1808. Xstruct mark_list *tmp_mark;
  1809. Xstruct core_list *sac_core;
  1810. Xchar tmp_ptr[MAXPATHLEN];
  1811. Xstruct core_list *sort_tmp[status.max_mark+1];
  1812. X
  1813. X while(test_mark!=&tail_mark){
  1814. X   sort_tmp[i]=test_mark->next_core;
  1815. X   tmp_mark=test_mark;
  1816. X   test_mark=test_mark->next_mark;
  1817. X   free(tmp_mark->mark_name);
  1818. X   free(tmp_mark);
  1819. X   i++;
  1820. X }
  1821. X head_mark.next_mark=&tail_mark;
  1822. X tail_mark.next_mark=&head_mark;
  1823. X status.max_mark=1;
  1824. X
  1825. X if(config.sort_mode)
  1826. X   sacdrt_shell(sort_tmp,n-1);
  1827. X else{
  1828. X   /*qsort((void *)sort_tmp,n-2,sizeof(head_core.next),
  1829. X          (int(*)(const void *,const void *))sacdrt_cmp);*/
  1830. X   /*qsort((void **)sort_tmp,n-1,sizeof(struct core_list *),
  1831. X             (int(*)(const void *,const void *))sacdrt_cmp);*/
  1832. X   sacdrt_qsort(sort_tmp,0,n-2);
  1833. X }
  1834. X
  1835. X if(sort.up_down)
  1836. X   i=0;
  1837. X else{
  1838. X   i=n-2;
  1839. X   n=0;
  1840. X }
  1841. X
  1842. X while(i!=n-1){
  1843. X   tmp_mark=(struct mark_list *)malloc(sizeof(struct mark_list));
  1844. X   if (tmp_mark==NULL)
  1845. X     sac_exit(7," in function sort_marked");
  1846. X
  1847. X   sac_core=sort_tmp[i];
  1848. X   switch(sac_core->mark_flag){
  1849. X     case use_name:  strcpy((char *)tmp_ptr,(const char *)(parse_core(sac_core->sac_line,8)));
  1850. X                     break;
  1851. X     case use_other: strcpy((char *)tmp_ptr,(const char *)(parse_core(sac_core->sac_line,9)));
  1852. X                     break;
  1853. X   }
  1854. X
  1855. X   tmp_mark->mark_name=(char *)malloc(strlen(tmp_ptr)+1);
  1856. X   strcpy((char *)tmp_mark->mark_name,tmp_ptr);
  1857. X   tmp_mark->mark_core=sac_core->core_count;
  1858. X   tmp_mark->mark_count=status.max_mark;
  1859. X   tmp_mark->next_core=sac_core;
  1860. X
  1861. X   tail_mark.next_mark->next_mark=tmp_mark;
  1862. X   tmp_mark->next_mark=&tail_mark;
  1863. X   tail_mark.next_mark=tmp_mark;
  1864. X
  1865. X   status.max_mark++;
  1866. X   if(sort.up_down)
  1867. X     i++;
  1868. X   else
  1869. X     i--;
  1870. X }
  1871. Xreturn;
  1872. X}
  1873. X
  1874. X
  1875. X
  1876. X/*
  1877. X *
  1878. X *  void SACDRT_QSORT(...)
  1879. X *  void SACDRT_SHELL(...)
  1880. X *  void SACDRT_CMP(...)
  1881. X *  void SACDRT_SWAP(...)  these are the functions for sorting an existing
  1882. X *                         list of marked objects. the shell sort will need
  1883. X *                         about 25sec for 10600 objects on a slow computer 
  1884. X *                         (386DX25) the quick sort works only faster up to
  1885. X *                         2000 objects. then it is abnormally slow (still
  1886. X *                         don't know why, may be sacdrt_cmp is the reaseon).
  1887. X *                         you can switch between the 2 sorting functions be-
  1888. X *                         fore you start a sort. when you save your config
  1889. X *                         to the init file, the current sort-function is 
  1890. X *                         saved, too.
  1891. X *                         The following functions are from K&R (with some
  1892. X *                         small changes).
  1893. X *
  1894. X */
  1895. Xvoid sacdrt_qsort(struct core_list *v[],int left,int right)
  1896. X{
  1897. Xint i,last;
  1898. X
  1899. X if(left>=right)
  1900. X   return;
  1901. X sacdrt_swap(v,left,(left+right)/2);
  1902. X last=left;
  1903. X for(i=left+1;i<=right;i++)
  1904. X    if(sacdrt_cmp(v[i],v[left])<0)
  1905. X      sacdrt_swap(v,++last,i);
  1906. X sacdrt_swap(v,left,last);
  1907. X sacdrt_qsort(v,left,last-1);
  1908. X sacdrt_qsort(v,last+1,right);
  1909. Xreturn;
  1910. X}
  1911. X
  1912. X
  1913. X
  1914. Xvoid sacdrt_swap(struct core_list *v[],int i,int j)
  1915. X{
  1916. Xstruct core_list *tmp;
  1917. X tmp=v[i];
  1918. X v[i]=v[j];
  1919. X v[j]=tmp;
  1920. Xreturn;
  1921. X}
  1922. X
  1923. X
  1924. X
  1925. Xint sacdrt_cmp(struct core_list *s1,struct core_list *s2)
  1926. X{
  1927. Xchar ptr1[MAXPATHLEN];
  1928. Xchar ptr2[MAXPATHLEN];
  1929. X
  1930. X switch(sort.sort_to){
  1931. X   case sort_name: if(s1->mark_flag==use_name)
  1932. X                     strcpy(ptr1,parse_core(s1->sac_line,8));
  1933. X                   else
  1934. X                     strcpy(ptr1,parse_core(s1->sac_line,9));
  1935. X                   if(s2->mark_flag==use_name)
  1936. X                     strcpy(ptr2,parse_core(s2->sac_line,8));
  1937. X                   else
  1938. X                     strcpy(ptr2,parse_core(s2->sac_line,9));
  1939. X                   break;
  1940. X   case sort_ra:   strcpy(ptr1,parse_core(s1->sac_line,4));
  1941. X                   strcpy(ptr2,parse_core(s2->sac_line,4));
  1942. X                   break;
  1943. X   case sort_mag:  strcpy(ptr1,parse_core(s1->sac_line,6));
  1944. X                   strcpy(ptr2,parse_core(s2->sac_line,6));
  1945. X                   break;
  1946. X   case sort_decl: strcpy(ptr1,parse_core(s1->sac_line,5));
  1947. X                   strcpy(ptr2,parse_core(s2->sac_line,5));
  1948. X                   break;
  1949. X   case sort_type: strcpy(ptr1,parse_core(s1->sac_line,2));
  1950. X                   strcpy(ptr2,parse_core(s2->sac_line,2));
  1951. X                   break;
  1952. X   case sort_con:  strcpy(ptr1,parse_core(s1->sac_line,3));
  1953. X                   strcpy(ptr2,parse_core(s2->sac_line,3));
  1954. X                   break;
  1955. X }
  1956. Xreturn (strcmp(ptr1,ptr2));
  1957. X}
  1958. X
  1959. X
  1960. X
  1961. Xvoid sacdrt_shell(struct core_list *v[],int n)
  1962. X{
  1963. Xint gap,i,j;
  1964. Xstruct core_list *tmp;
  1965. X
  1966. X for(gap=n/2;gap>0;gap/=2){
  1967. X   if(config.curses){
  1968. X      mvwprintw(message_win,1,13,"%i  ",gap);
  1969. X      wrefresh(message_win);
  1970. X   }
  1971. X   for(i=gap;i<n;i++)
  1972. X     for(j=i-gap;j>=0&&(sacdrt_cmp(v[j],v[j+gap])>0);j-=gap){
  1973. X       tmp=v[j];
  1974. X       v[j]=v[j+gap];
  1975. X       v[j+gap]=tmp;
  1976. X     }
  1977. X }
  1978. Xreturn;
  1979. X}
  1980. END_OF_FILE
  1981.   if test 14528 -ne `wc -c <'sacdrt3.1/sacdrt_term/mark_objects.c'`; then
  1982.     echo shar: \"'sacdrt3.1/sacdrt_term/mark_objects.c'\" unpacked with wrong size!
  1983.   fi
  1984.   # end of 'sacdrt3.1/sacdrt_term/mark_objects.c'
  1985. fi
  1986. if test -f 'sacdrt3.1/sacdrt_term/p_cord.c' -a "${1}" != "-c" ; then 
  1987.   echo shar: Will not clobber existing file \"'sacdrt3.1/sacdrt_term/p_cord.c'\"
  1988. else
  1989.   echo shar: Extracting \"'sacdrt3.1/sacdrt_term/p_cord.c'\" \(4988 characters\)
  1990.   sed "s/^X//" >'sacdrt3.1/sacdrt_term/p_cord.c' <<'END_OF_FILE'
  1991. X/*
  1992. X * SACDRT Version 3.1 SAC-Database-Reader for DeepSky Objects
  1993. X * Module P_CORD.C is written by Lars Hagen for the SACDRT.
  1994. X *
  1995. X *  Copyright (C) 1994 Lars Hagen & Sven van der Meer
  1996. X *
  1997. X *  This program is free software; you can redistribute it and/or modify
  1998. X *  it under the terms of the GNU General Public License as published by
  1999. X *  the Free Software Foundation; either version 2 of the License, or
  2000. X *  (at your option) any later version.
  2001. X *
  2002. X *  This program is distributed in the hope that it will be useful,
  2003. X *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  2004. X *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  2005. X *  GNU General Public License for more details.
  2006. X *
  2007. X *  You should have received a copy of the GNU General Public License
  2008. X *  along with this program; if not, write to the Free Software
  2009. X *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  2010. X *
  2011. X *  Problems or comments to hagenl@cs.tu-berlin.de
  2012. X *                                                                   
  2013. X */
  2014. X
  2015. X/* BUG:    DEGREE CHARACTER NOT POSSIBLE !!!                               */
  2016. X
  2017. X#include <string.h>
  2018. X#include <stdlib.h>
  2019. X#include <ctype.h>
  2020. X#include "sacdrt.h"
  2021. Xvoid is_empty(char *s);
  2022. X
  2023. Xint parse_ra(char *string)                    /* PARSE RA              */
  2024. X{
  2025. X  int i=0;
  2026. X  while (string[i] != '\0')               /* if not EndOfString    */
  2027. X    {                                     /* compare of " ", when  */
  2028. X      if (string[i] == ' ')               /* found change          */
  2029. X    string[i] = 'h';                  /* " " -> "h"            */
  2030. X      i++;
  2031. X    }
  2032. X  return 0;
  2033. X}
  2034. X
  2035. X/***************************************************************************/
  2036. X
  2037. Xint parse_dec(char *string)               /* PARSE DEC             */
  2038. X{                                         /* if not EndOfString    */
  2039. X  int i=0;                                /* compare of " ", when  */
  2040. X  while (string[i] != '\0')               /* found change          */
  2041. X    {                                     /* " " -> "o"            */
  2042. X      if (string[i] == ' ')
  2043. X    string[i] = 'o';                  /* DEGREE CHARACTER      */
  2044. X      i++;
  2045. X    }
  2046. X  strcat(string,"'");                     /* append to string "'"  */
  2047. X  return 0;
  2048. X}
  2049. X
  2050. X/***************************************************************************/
  2051. X
  2052. Xint parse_mag(char *string,int call)              /* PARSE MAG             */
  2053. X{                                                 /* append to value of mag*/
  2054. X  char *dark     = "Dark nebula hasn't a magnitude";  /* " mag".               */
  2055. X  char *likedark = "(see brightness)";
  2056. X  char *unknown  = "unknown";                      
  2057. X                                                                    
  2058. X  if (*string == '0')
  2059. X   {
  2060. X    string++;
  2061. X    if (*string != '.')
  2062. X     {
  2063. X      string--;
  2064. X      *string =  ' ';
  2065. X     }
  2066. X    else
  2067. X     string--;
  2068. X   }
  2069. X
  2070. X
  2071. X  if (strcmp(string,"79.9") == 0)
  2072. X    {
  2073. X      if(call == 1)
  2074. X    strcpy(string, likedark);
  2075. X      else
  2076. X    strcpy(string,dark);
  2077. X    }
  2078. X  else
  2079. X    if (strcmp(string,"99.9") == 0)
  2080. X      strcpy(string,unknown);
  2081. X    else
  2082. X      strcat(string," mag");
  2083. X  return 0;
  2084. X}
  2085. X
  2086. X/***************************************************************************/
  2087. X
  2088. Xint parse_brstr(char *string)                     /* PARSE BRSTR           */
  2089. X{                                                 /* if 1st char in string */
  2090. X  if (*string != '\0')                            /* not EndOfString append*/
  2091. X    strcat(string," mag");                        /* " mag" to string      */
  2092. X  else
  2093. X    is_empty(string);
  2094. X  return 0;
  2095. X}
  2096. X
  2097. X/***************************************************************************/
  2098. X
  2099. Xint parse_size(char *string)          /* PARSE SIZE                        */
  2100. X{
  2101. X  static char *helpstring;
  2102. X  static char *oldstringbegin;
  2103. X
  2104. X  oldstringbegin = string;            /* secure string-pointer to begin    */
  2105. X  helpstring = (char *)malloc(30+sizeof(string));
  2106. X  helpstring[0] = '\0';
  2107. X  
  2108. X  while (*string != '\0')             /* if not EndOfString check string   */
  2109. X    {                                 /* "X". When found change this to    */
  2110. X      switch(*string)
  2111. X    {
  2112. X    case 'X':
  2113. X      strcat(helpstring," x ");
  2114. X      break;
  2115. X    case '.':
  2116. X      string--;
  2117. X      if(isdigit(*string++))
  2118. X        strcat(helpstring,".");
  2119. X      else
  2120. X        strcat(helpstring,"0.");
  2121. X      break;
  2122. X    default:
  2123. X      {
  2124. X        static char helpchar[1];
  2125. X        helpchar[1] = '\0';
  2126. X        helpchar[0] = *string;
  2127. X        strcat(helpstring,helpchar);
  2128. X      }
  2129. X    }
  2130. X      string++;
  2131. X    }
  2132. X  string = oldstringbegin;            /* rewrite orginal string-pointer    */
  2133. X  strcpy(string, helpstring);         /* copy Sizehelp string to string    */
  2134. X  
  2135. X  if (*string == '\0')
  2136. X    is_empty(string);
  2137. X  free(helpstring);
  2138. X  return 0;
  2139. X}
  2140. X
  2141. X/****************************************************************************/
  2142. X
  2143. Xint parse_nsts(char *string)
  2144. X{
  2145. X  if (*string == '\0')
  2146. X    is_empty(string);
  2147. X  return 0;
  2148. X}
  2149. X
  2150. X/****************************************************************************/
  2151. X
  2152. Xvoid is_empty(char *s)
  2153. X{
  2154. X  if(*s == '\0')
  2155. X    strcpy(s, "N/A");
  2156. X}
  2157. X
  2158. X
  2159. X
  2160. X
  2161. X
  2162. X
  2163. X
  2164. X
  2165. END_OF_FILE
  2166.   if test 4988 -ne `wc -c <'sacdrt3.1/sacdrt_term/p_cord.c'`; then
  2167.     echo shar: \"'sacdrt3.1/sacdrt_term/p_cord.c'\" unpacked with wrong size!
  2168.   fi
  2169.   # end of 'sacdrt3.1/sacdrt_term/p_cord.c'
  2170. fi
  2171. if test -f 'sacdrt3.1/sacdrt_term/p_descr.c' -a "${1}" != "-c" ; then 
  2172.   echo shar: Will not clobber existing file \"'sacdrt3.1/sacdrt_term/p_descr.c'\"
  2173. else
  2174.   echo shar: Extracting \"'sacdrt3.1/sacdrt_term/p_descr.c'\" \(16070 characters\)
  2175.   sed "s/^X//" >'sacdrt3.1/sacdrt_term/p_descr.c' <<'END_OF_FILE'
  2176. X/*
  2177. X * SACDRT Version 3.1 SAC-Database-Reader for DeepSky Objects
  2178. X * Module P_DESCR.C is written by Lars Hagen for the SACDRT.
  2179. X *
  2180. X *  Copyright (C) 1994 Lars Hagen & Sven van der Meer
  2181. X *
  2182. X *  This program is free software; you can redistribute it and/or modify
  2183. X *  it under the terms of the GNU General Public License as published by
  2184. X *  the Free Software Foundation; either version 2 of the License, or
  2185. X *  (at your option) any later version.
  2186. X *
  2187. X *  This program is distributed in the hope that it will be useful,
  2188. X *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  2189. X *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  2190. X *  GNU General Public License for more details.
  2191. X *
  2192. X *  You should have received a copy of the GNU General Public License
  2193. X *  along with this program; if not, write to the Free Software
  2194. X *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  2195. X *
  2196. X *  Problems or comments to hagenl@cs.tu-berlin.de
  2197. X *                                                                   
  2198. X */
  2199. X
  2200. X#include <string.h>
  2201. X#include <stdlib.h>
  2202. X#include <ctype.h>
  2203. X#include "sacdrt.h"
  2204. X
  2205. X#define   YES           1
  2206. X#define   NO            0
  2207. X#define   NOT_SET      1
  2208. X#define   KOMMA_SET    0
  2209. X
  2210. X/* use this function later in this module */
  2211. X
  2212. Xvoid parse_descr_string(char *short_string, char *helpstring);
  2213. Xint  numbers(char *short_string, char *helpstring);
  2214. Xint  default_descr(char *s,char *oldhelpstringend,char *old_s,int oldhelpstringlenght, char *helpstring);
  2215. Xint  cat_2_helpstring(char *short_string, char *long_string, char *helpstring, char *s);
  2216. X
  2217. Xint komma           = NOT_SET;
  2218. Xint star_FLAG       = NO;
  2219. Xint elogated_FLAG   = NO;
  2220. Xint paired_FLAG     = NO;
  2221. Xint degree_FLAG     = NO;
  2222. Xint klammer_op_FLAG = NO;
  2223. Xint klammer_cl_FLAG = NO;
  2224. Xint EOS_FLAG        = NO;
  2225. Xint mag_FLAG        = NO;
  2226. X
  2227. Xint parse_descr(char *string)
  2228. X{
  2229. X  static int i;
  2230. X  static char *helpstring;
  2231. X  static char *short_string;
  2232. X  static char *oldstringbegin;
  2233. X
  2234. X  i = 0;
  2235. X  star_FLAG      = NO;
  2236. X  elogated_FLAG  = NO;
  2237. X  oldstringbegin = string;
  2238. X  
  2239. X  short_string = (char *) malloc(100+sizeof(string));
  2240. X  helpstring   = (char *) malloc(500+sizeof(string));
  2241. X  *short_string = '\0';
  2242. X  *helpstring   = '\0';
  2243. X  
  2244. X  while(*string != '\0')                                                /* cat the string to many shorter */
  2245. X    {
  2246. X      while(*string != ',' && *string != '\0' && *string != ' ' &&
  2247. X        *string != '(' && *string != ')')
  2248. X    {
  2249. X      short_string[i] = *string++;
  2250. X      i++;
  2251. X    }
  2252. X      short_string[i] = '\0';                                            /* mark end                       */
  2253. X      i = 0;
  2254. X      
  2255. X      if (*string == ',')                                                /* set FLAG's                     */
  2256. X    komma = 1;           
  2257. X      else                   
  2258. X    komma = 0;
  2259. X      if (*string == '(')
  2260. X    klammer_op_FLAG = YES;
  2261. X      if (*string == ')')
  2262. X    klammer_cl_FLAG = YES;
  2263. X      
  2264. X      if (*string != '\0')
  2265. X    string++;
  2266. X      else
  2267. X    EOS_FLAG = 1;
  2268. X      
  2269. X      parse_descr_string(short_string,helpstring);                        /* call parser for these shorter */
  2270. X    }
  2271. X  string = oldstringbegin;
  2272. X  strcpy(string, helpstring);
  2273. X    
  2274. X  if (*string == '\0')
  2275. X    is_empty(string);
  2276. X  free(short_string);
  2277. X  free(helpstring);
  2278. X  return 0; 
  2279. X}
  2280. X
  2281. Xvoid parse_descr_string(char *s, char *helpstring)
  2282. X{
  2283. X  static int getorginal;
  2284. X  int oldhelpstringlenght;
  2285. X  char *oldhelpstringend;
  2286. X  char *old_s;  
  2287. X  old_s = s;
  2288. X  getorginal = 0;
  2289. X
  2290. X  oldhelpstringlenght = strlen(helpstring);
  2291. X  oldhelpstringend = helpstring + oldhelpstringlenght;
  2292. X  
  2293. X  if(elogated_FLAG == YES && (isdigit(*s)))
  2294. X    {
  2295. X      strcat(helpstring,"in position angel of ");
  2296. X      (int)s = numbers(s, helpstring);
  2297. X      s++;
  2298. X      strcat(helpstring, " degrees");
  2299. X      elogated_FLAG = NO;
  2300. X      degree_FLAG = YES;
  2301. X    }
  2302. X  if(paired_FLAG == YES && *s == 'w')
  2303. X    {
  2304. X      s++;
  2305. X      strcat(helpstring,"paired with");
  2306. X    }
  2307. X  paired_FLAG = NO;
  2308. X  if((degree_FLAG == YES) && ((strcmp(s, "deg") == 0) || ((strcmp(s, "degrees") == 0))))
  2309. X     {
  2310. X       degree_FLAG = NO;
  2311. X       *s = '\0';
  2312. X     }
  2313. X
  2314. X  /* parse for each character the string and find the correct contens els take the orginalstring  */
  2315. X  
  2316. X  while (*s != '\0')                  
  2317. X    {
  2318. X      switch(*s)
  2319. X    {
  2320. X    case 'a':
  2321. X      if(strcmp(s,"am") == 0)
  2322. X        (int)s = cat_2_helpstring("am", "among", helpstring, s);
  2323. X      else
  2324. X        if(strcmp(s,"att") == 0)
  2325. X          (int)s = cat_2_helpstring("att", "attached", helpstring, s);
  2326. X        else
  2327. X          if(strcmp(s,"alm") == 0)
  2328. X        (int)s = cat_2_helpstring("alm", "almost", helpstring, s);
  2329. X          else
  2330. X        if(strcmp(s,"approx") == 0)
  2331. X          (int)s = cat_2_helpstring("approx", "approximately", helpstring, s);
  2332. X        else
  2333. X          {
  2334. X            getorginal = 1;
  2335. X            default_descr(s,oldhelpstringend,old_s,oldhelpstringlenght,helpstring);
  2336. X          }
  2337. X      break;
  2338. X    case 'b':
  2339. X      if(strcmp(s,"bet") == 0)
  2340. X        (int)s = cat_2_helpstring("bet", "between", helpstring, s);
  2341. X      else
  2342. X        strcat(helpstring, "brighter");
  2343. X      break;
  2344. X    case 'c':
  2345. X      if(strcmp(s,"cent") == 0)
  2346. X        (int)s = cat_2_helpstring("cent", "center", helpstring, s);
  2347. X      else
  2348. X        if(strcmp(s,"centre") == 0)
  2349. X          (int)s = cat_2_helpstring("centre", "center", helpstring, s);
  2350. X        else
  2351. X          if(strcmp(s,"centri") == 0)
  2352. X        (int)s = cat_2_helpstring("centri", "center", helpstring, s);
  2353. X          else
  2354. X        if(strcmp(s,"comp") == 0)
  2355. X          (int)s = cat_2_helpstring("comp", "complex", helpstring, s);
  2356. X        else
  2357. X          if(strcmp(s,"cont") == 0)
  2358. X            (int)s = cat_2_helpstring("cont", "contact", helpstring, s);
  2359. X          else
  2360. X            strcat(helpstring, "considerably");
  2361. X      break;
  2362. X    case 'd':
  2363. X      if(strcmp(s,"def") == 0)
  2364. X        (int)s = cat_2_helpstring("def", "defined", helpstring, s);
  2365. X      else
  2366. X        if(strcmp(s,"diam") == 0)
  2367. X          (int)s = cat_2_helpstring("diam", "diameter", helpstring, s);
  2368. X        else
  2369. X          if(strcmp(s,"dif") == 0)
  2370. X        (int)s = cat_2_helpstring("dif", "diffuse", helpstring, s);
  2371. X          else
  2372. X        if(strcmp(s,"diffic") == 0)
  2373. X          (int)s = cat_2_helpstring("diffic", "difficult", helpstring, s);
  2374. X        else
  2375. X          if(strcmp(s,"diff") == 0)
  2376. X            (int)s = cat_2_helpstring("diff", "diffuse", helpstring, s);
  2377. X          else
  2378. X            if(strcmp(s,"decl") == 0)
  2379. X              (int)s = cat_2_helpstring("decl", "declination", helpstring, s);
  2380. X            else
  2381. X              if((strcmp(s,"deg") == 0) && degree_FLAG == NO)
  2382. X            (int)s = cat_2_helpstring("deg", "degrees", helpstring, s);
  2383. X              else
  2384. X            if(strcmp(s,"degrees") == 0)
  2385. X              (int)s = cat_2_helpstring("degrees", "degrees", helpstring, s);
  2386. X            else
  2387. X              {
  2388. X                getorginal = 1;
  2389. X                default_descr(s,oldhelpstringend,old_s,oldhelpstringlenght,helpstring);
  2390. X              }
  2391. X      break;
  2392. X    case 'e':
  2393. X      if(strcmp(s,"end") == 0)
  2394. X        (int)s = cat_2_helpstring("end", "end", helpstring, s);
  2395. X      else
  2396. X        {
  2397. X          if(*++s == 'r')
  2398. X        strcat(helpstring, "easily resolved");
  2399. X          else
  2400. X        {
  2401. X          if(*s == 'e')
  2402. X            strcat(helpstring, "very extremely");
  2403. X          else
  2404. X            {
  2405. X              strcat(helpstring, "extremely");
  2406. X              s--;
  2407. X            }
  2408. X        }
  2409. X        }
  2410. X      break;
  2411. X    case 'f':
  2412. X      strcat(helpstring, "following");
  2413. X      break;
  2414. X    case 'g':
  2415. X      strcat(helpstring, "gradually");
  2416. X      break;
  2417. X      
  2418. X    case 'I':
  2419. X    case 'i':
  2420. X      if(strcmp(s,"inv") == 0)
  2421. X        (int)s = cat_2_helpstring("inv", "involved", helpstring, s);
  2422. X      else
  2423. X        if(strcmp(s,"irr") == 0)
  2424. X          (int)s = cat_2_helpstring("irr", "irregular", helpstring, s);
  2425. X        else
  2426. X          if(strcmp(s,"in") == 0)
  2427. X        (int)s = cat_2_helpstring("in", "in", helpstring, s);
  2428. X          else
  2429. X        {
  2430. X          if(*++s == 'F')
  2431. X            strcat(helpstring, "irregular figure");
  2432. X          else
  2433. X            {
  2434. X              s--;
  2435. X              strcat(helpstring, "irregular");
  2436. X            }
  2437. X        }
  2438. X      break;
  2439. X    case 'l':
  2440. X      if(strcmp(s,"line") == 0)
  2441. X        (int)s = cat_2_helpstring("line", "line", helpstring, s);
  2442. X      else
  2443. X        strcat(helpstring, "little");
  2444. X      break;
  2445. X    case 'm':
  2446. X      if(mag_FLAG == NO)
  2447. X        if(strcmp(s,"mag") == 0)
  2448. X          (int)s = cat_2_helpstring("mag", "mag", helpstring, s);
  2449. X        else
  2450. X          strcat(helpstring, "much");
  2451. X      break;
  2452. X    case 'n':
  2453. X      if(strcmp(s,"neb") == 0)
  2454. X        (int)s = cat_2_helpstring("neb", "nebulosity", helpstring, s);
  2455. X      else
  2456. X        if(strcmp(s,"neb?") == 0)
  2457. X          (int)s = cat_2_helpstring("neb?", "nebulous ?", helpstring, s);
  2458. X        else
  2459. X          if(strcmp(s,"neby") == 0)
  2460. X        (int)s = cat_2_helpstring("neby", "nebulosity", helpstring, s);
  2461. X          else
  2462. X        if(strcmp(s,"nebulous?") == 0)
  2463. X          (int)s = cat_2_helpstring("nebulous?", "nebulous ?", helpstring, s);
  2464. X        else
  2465. X          if(strcmp(s,"nebs?") == 0)
  2466. X            (int)s = cat_2_helpstring("nebs?", "nebulous ?", helpstring, s);
  2467. X          else
  2468. X            if(strcmp(s,"nr") == 0)
  2469. X              (int)s = cat_2_helpstring("nr", "near", helpstring, s);
  2470. X            else
  2471. X              strcat(helpstring, "north");
  2472. X      break;
  2473. X    case 'p':
  2474. X      if(strcmp(s,"pts") == 0)
  2475. X        (int)s = cat_2_helpstring("pts", "points", helpstring, s);
  2476. X      else
  2477. X        s++;                             
  2478. X      if(*s == 'F' || *s == 'S' ||    
  2479. X         *s == 'L' || *s == 'B')      
  2480. X        strcat(helpstring, "pretty");
  2481. X      else
  2482. X        strcat(helpstring, "preceding");
  2483. X      s--;
  2484. X      break;
  2485. X    case 'r':
  2486. X      s++;s++;
  2487. X      if(*s == 'r')
  2488. X        strcat(helpstring, "well resolved");
  2489. X      else
  2490. X        {
  2491. X          if (*--s == 'r')
  2492. X        strcat(helpstring, "partially resolved");
  2493. X          else
  2494. X        {
  2495. X          s--;
  2496. X          strcat(helpstring, "not well resolved");
  2497. X        }
  2498. X        }
  2499. X      break;
  2500. X    case 's':
  2501. X      if(strcmp(s,"struct") == 0)
  2502. X        (int)s = cat_2_helpstring("struct", "structure", helpstring, s);
  2503. X      else
  2504. X        if(strcmp(s,"susp") == 0)
  2505. X          (int)s = cat_2_helpstring("susp", "suspected", helpstring, s);
  2506. X        else
  2507. X          if(strcmp(s,"stell") == 0)
  2508. X        (int)s = cat_2_helpstring("stell", "stellar", helpstring, s);
  2509. X          else
  2510. X        if(strcmp(s,"stellar") == 0)
  2511. X          (int)s = cat_2_helpstring("stellar", "stellar", helpstring, s);
  2512. X        else
  2513. X          if(strcmp(s,"sev") == 0)
  2514. X            (int)s = cat_2_helpstring("sev", "several", helpstring, s);
  2515. X          else
  2516. X            if(strcmp(s,"several") == 0)
  2517. X              (int)s = cat_2_helpstring("several", "several", helpstring, s);
  2518. X            else
  2519. X              {
  2520. X            s++;
  2521. X            if(*s == 'c')
  2522. X              {
  2523. X                strcat(helpstring, "scattered");
  2524. X                s++;
  2525. X              }
  2526. X            else
  2527. X              if(*s == 't')
  2528. X                {
  2529. X                  strcat(helpstring, "star or stellar");
  2530. X                  star_FLAG = YES;
  2531. X                  s++;
  2532. X                }
  2533. X              else
  2534. X                {
  2535. X                  char *secure_s;
  2536. X                  secure_s = s;
  2537. X                  while(*s != '\0' && *s != 'b')
  2538. X                s++;
  2539. X                  if(*s == 'b')
  2540. X                strcat(helpstring,"suddenly");
  2541. X                  else
  2542. X                strcat(helpstring, "south");
  2543. X                  s = secure_s;
  2544. X                }
  2545. X            s--;
  2546. X              }
  2547. X      break;
  2548. X    case 't':
  2549. X      if(strcmp(s,"tri") == 0)
  2550. X        (int)s = cat_2_helpstring("tri", "triple", helpstring, s);
  2551. X      else
  2552. X        {
  2553. X          getorginal = 1;
  2554. X          default_descr(s,oldhelpstringend,old_s,oldhelpstringlenght,helpstring);
  2555. X        }
  2556. X      break;
  2557. X    case 'v':
  2558. X      if(strcmp(s,"var") == 0)
  2559. X        (int)s = cat_2_helpstring("var", "variable", helpstring, s);
  2560. X      else
  2561. X        strcat(helpstring, "very");
  2562. X      break;
  2563. X    case 'w':
  2564. X      strcat(helpstring, "with");
  2565. X      break;
  2566. X    case 'B':
  2567. X      strcat(helpstring, "bright");
  2568. X      break;
  2569. X    case 'C':
  2570. X      if(*++s == 'l')
  2571. X        strcat(helpstring, "cluster");
  2572. X      else
  2573. X        {
  2574. X          strcat(helpstring, "compressed");
  2575. X          s--;
  2576. X        }
  2577. X      break;
  2578. X    case 'D':
  2579. X      strcat(helpstring, "double");
  2580. X      break;
  2581. X    case 'E':
  2582. X      strcat(helpstring, "elongated");
  2583. X      switch(*++s)
  2584. X        {
  2585. X        case '1':
  2586. X        case '2':
  2587. X        case '3':
  2588. X        case '4':
  2589. X        case '5':
  2590. X        case '6':
  2591. X        case '7':
  2592. X        case '8':
  2593. X        case '9':
  2594. X        case '0':
  2595. X          {
  2596. X        strcat(helpstring," in position angel of ");
  2597. X        (int)s = numbers(s,helpstring);
  2598. X        strcat(helpstring, " degrees");
  2599. X        s++;
  2600. X          }
  2601. X        default:
  2602. X          if(komma == KOMMA_SET)
  2603. X        elogated_FLAG = YES;
  2604. X          s--;
  2605. X        }
  2606. X      break;
  2607. X     case 'F':    strcat(helpstring, "faint");
  2608. X        break;
  2609. X     case 'L':    strcat(helpstring, "large");
  2610. X        break;
  2611. X     case 'M':    strcat(helpstring, "middle");
  2612. X        break;
  2613. X     case 'N':    strcat(helpstring, "nucleus");
  2614. X        break;
  2615. X     case 'P':    strcat(helpstring, "poor");
  2616. X        paired_FLAG = YES;
  2617. X        break;
  2618. X    case 'R':
  2619. X      if(*++s == 'i' || *s == 'I')
  2620. X        strcat(helpstring, "rich");
  2621. X      else
  2622. X        {
  2623. X          strcat(helpstring, "round");
  2624. X          s--;
  2625. X        }
  2626. X      break;
  2627. X     case 'S':    strcat(helpstring, "small");
  2628. X        break;
  2629. X     case '-':    strcat(helpstring, "to");
  2630. X        break;
  2631. X    case '*':
  2632. X      if(*++s == '*')
  2633. X        strcat(helpstring, "double");
  2634. X      else
  2635. X        s--;
  2636. X      strcat(helpstring, "star");
  2637. X      star_FLAG = YES;
  2638. X      break;
  2639. X     case '=':    strcat(helpstring, "equal");
  2640. X        break;
  2641. X     case '&':    strcat(helpstring, "and");
  2642. X        break;
  2643. X     case '?':    strcat(helpstring,"(it's uncertain)");
  2644. X        break;
  2645. X     case '+':    strcat(helpstring,"+");
  2646. X        break;
  2647. X     case '(':  strcat(helpstring,"(");
  2648. X            break;
  2649. X     case ')':    strcat(helpstring,")");
  2650. X        break;
  2651. X     case ';':    strcat(helpstring,";");
  2652. X        break;
  2653. X     case '!':  s++;
  2654. X         if(*++s == '!')
  2655. X          strcat(helpstring, "well remarkable object");
  2656. X         else
  2657. X           {
  2658. X             if (*--s == '!')
  2659. X               strcat(helpstring, "very remarkable object");
  2660. X             else
  2661. X               {
  2662. X             s--;
  2663. X             strcat(helpstring, "remarkable object");
  2664. X               }
  2665. X           }
  2666. X      break;
  2667. X     case '1':
  2668. X     case '2':
  2669. X     case '3':
  2670. X     case '4':
  2671. X     case '5':
  2672. X     case '6':
  2673. X     case '7':
  2674. X     case '8':
  2675. X     case '9':
  2676. X     case '0':
  2677. X     case '.':
  2678. X     case 0x27:
  2679. X      {
  2680. X        (int)s = numbers(s, helpstring);
  2681. X        break;
  2682. X      }
  2683. X     default :  {
  2684. X        default_descr(s,oldhelpstringend,old_s,oldhelpstringlenght,helpstring);
  2685. X        getorginal = 1;
  2686. X      }
  2687. X    }
  2688. X    if (getorginal == 1)
  2689. X      {
  2690. X    if (komma == 0) strcat(helpstring, " ");
  2691. X    *s = '\0';
  2692. X      }
  2693. X    else
  2694. X      {
  2695. X    s++;
  2696. X    if (*s != '\0' || komma == 0) strcat(helpstring," ");
  2697. X      }
  2698. X  }
  2699. X
  2700. X  if(klammer_op_FLAG == YES)                        /* check the flag settings and action then */
  2701. X    {
  2702. X      strcat(helpstring, "(");
  2703. X      klammer_op_FLAG = NO;
  2704. X    }
  2705. X  if(klammer_cl_FLAG == YES)
  2706. X    {
  2707. X      char *old_help_secure;
  2708. X      old_help_secure = helpstring;
  2709. X      while(*helpstring++ != '\0');
  2710. X      --helpstring;
  2711. X      *--helpstring = ')';
  2712. X      *++helpstring = '\0';
  2713. X      helpstring = old_help_secure;
  2714. X      klammer_cl_FLAG = NO;
  2715. X    }  
  2716. X  if (komma == NOT_SET)
  2717. X    {
  2718. X      strcat(helpstring,",");      /* if komma-flag is set  */
  2719. X      degree_FLAG = NO;
  2720. X    }
  2721. X  if (star_FLAG == YES && komma == NOT_SET)
  2722. X    star_FLAG = NO;
  2723. X  
  2724. X}
  2725. X
  2726. X/* spezial parser for numbers and to correct the mistakes from the database    */
  2727. X
  2728. Xint numbers(char *s, char *helpstring)        
  2729. X{
  2730. X  static int i;
  2731. X  int counter;
  2732. X  counter = 0;
  2733. X  i = 0;
  2734. X
  2735. X  while (*s != '\0' && (isdigit(*s) || *s == '.' || *s == 0x27 || *s == 'm'))
  2736. X    {
  2737. X      char *numhelp;
  2738. X      numhelp = (char *)malloc(sizeof(s)+10);
  2739. X
  2740. X      *numhelp = *s;
  2741. X      *++numhelp = '\0';
  2742. X      numhelp--;
  2743. X
  2744. X      switch(*s)
  2745. X    {
  2746. X       case '.':
  2747. X
  2748. X      while((*s == '.') && (*s != '\0')) {s++; counter++; }
  2749. X      if(counter == 1)
  2750. X        {
  2751. X          strcat(helpstring, ".");
  2752. X          if (*s != '\0') s--;
  2753. X        }
  2754. X      else
  2755. X        if(*s != '\0' && (isdigit(*s)))
  2756. X          {
  2757. X        strcat(helpstring, "th to ");
  2758. X        while(*s != '\0' && (isdigit(*s)))
  2759. X          {
  2760. X            *numhelp = *s; *++numhelp = '\0'; numhelp--;
  2761. X            strcat(helpstring, numhelp);
  2762. X            if (*s != '\0') s++;
  2763. X          }
  2764. X        strcat(helpstring, "th magnitude");
  2765. X        star_FLAG = NO;
  2766. X          }
  2767. X        else
  2768. X          {
  2769. X        strcat(helpstring, "th magnitude and fainther");
  2770. X        star_FLAG = NO;
  2771. X          }
  2772. X      break;
  2773. X
  2774. X    case 'm':
  2775. X      if(star_FLAG == YES)
  2776. X        star_FLAG = NO;
  2777. X      strcat(helpstring, "th magnitude");
  2778. X      break;
  2779. X      
  2780. X    case 0x27:
  2781. X      if(star_FLAG == YES)
  2782. X        star_FLAG = NO;
  2783. X      if(*++s == 0x27)
  2784. X        {
  2785. X          strcat(helpstring, " seconds");
  2786. X        }
  2787. X      else
  2788. X        {
  2789. X          strcat(helpstring," minutes");
  2790. X          s--;
  2791. X        }
  2792. X      break;
  2793. X      
  2794. X    default:      strcat(helpstring,numhelp);
  2795. X    }
  2796. X      if(*s != '\0')
  2797. X    s++;
  2798. X      free(numhelp);
  2799. X    }
  2800. X  if (star_FLAG == YES)
  2801. X    {
  2802. X      strcat(helpstring, "th magnitude");
  2803. X      mag_FLAG = YES;
  2804. X      star_FLAG = NO;
  2805. X    }
  2806. X  (int)s = s-1;
  2807. X  return (int)s;
  2808. X}
  2809. X
  2810. X/* if parsing not possible write the orginal to the helpstring  */
  2811. X
  2812. Xint default_descr(char *s,char *oldhelpstringend,char *old_s,int oldhelpstringlenght, char *helpstring)
  2813. X{
  2814. X  helpstring = oldhelpstringend;
  2815. X  *helpstring = '\0';
  2816. X  s = old_s;
  2817. X  strcat(helpstring, s);
  2818. X  return 0;
  2819. X}
  2820. X
  2821. X/* append to helpstring   */
  2822. X
  2823. Xint cat_2_helpstring(char *short_string, char *long_string, char *helpstring, char *s)
  2824. X{
  2825. X  strcat(helpstring, long_string);
  2826. X  s = s+strlen(short_string)-1;
  2827. X  return (int)s;
  2828. X}
  2829. END_OF_FILE
  2830.   if test 16070 -ne `wc -c <'sacdrt3.1/sacdrt_term/p_descr.c'`; then
  2831.     echo shar: \"'sacdrt3.1/sacdrt_term/p_descr.c'\" unpacked with wrong size!
  2832.   fi
  2833.   # end of 'sacdrt3.1/sacdrt_term/p_descr.c'
  2834. fi
  2835. echo shar: End of archive 1 \(of 4\).
  2836. cp /dev/null ark1isdone
  2837. MISSING=""
  2838. for I in 1 2 3 4 ; do
  2839.     if test ! -f ark${I}isdone ; then
  2840.     MISSING="${MISSING} ${I}"
  2841.     fi
  2842. done
  2843. if test "${MISSING}" = "" ; then
  2844.     echo You have unpacked all 4 archives.
  2845.     rm -f ark[1-9]isdone
  2846. else
  2847.     echo You still must unpack the following archives:
  2848.     echo "        " ${MISSING}
  2849. fi
  2850. exit 0
  2851. exit 0 # Just in case...
  2852.