ttrm.C 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /*
  2. * CDE - Common Desktop Environment
  3. *
  4. * Copyright (c) 1993-2012, The Open Group. All rights reserved.
  5. *
  6. * These libraries and programs are free software; you can
  7. * redistribute them and/or modify them under the terms of the GNU
  8. * Lesser General Public License as published by the Free Software
  9. * Foundation; either version 2 of the License, or (at your option)
  10. * any later version.
  11. *
  12. * These libraries and programs are distributed in the hope that
  13. * they will be useful, but WITHOUT ANY WARRANTY; without even the
  14. * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  15. * PURPOSE. See the GNU Lesser General Public License for more
  16. * details.
  17. *
  18. * You should have received a copy of the GNU Lesser General Public
  19. * License along with these libraries and programs; if not, write
  20. * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
  21. * Floor, Boston, MA 02110-1301 USA
  22. */
  23. //%% (c) Copyright 1993, 1994 Hewlett-Packard Company
  24. //%% (c) Copyright 1993, 1994 International Business Machines Corp.
  25. //%% (c) Copyright 1993, 1994 Sun Microsystems, Inc.
  26. //%% (c) Copyright 1993, 1994 Novell, Inc.
  27. //%% $XConsortium: ttrm.C /main/3 1995/10/20 16:37:34 rswiston $
  28. /* @(#)ttrm.C 1.12 93/07/30
  29. * ttrm.cc - Link Service/ToolTalk wrapper for rm(1).
  30. *
  31. * Copyright (c) 1990 by Sun Microsystems, Inc.
  32. *
  33. */
  34. #include <stdlib.h>
  35. #include <locale.h>
  36. #include <util/copyright.h>
  37. #include <tt_options.h>
  38. #include "remover.h"
  39. /*
  40. * External variables
  41. */
  42. TT_INSERT_COPYRIGHT
  43. #ifdef OPT_PATCH
  44. static char PatchID[] = "Patch Id: 100626_03.";
  45. static int Patch_ID100626_03;
  46. #endif
  47. /*
  48. * main()
  49. */
  50. int
  51. main(int argc, char **argv)
  52. {
  53. Tt_status tterr = TT_OK;
  54. remover *ttrm = new remover( argv[0] );
  55. setlocale( LC_ALL, "" );
  56. ttrm->parse_args( argc, argv );
  57. tterr = ttrm->open_tt();
  58. if (ttrm->tt_opened()) {
  59. tterr = ttrm->do_ttrm();
  60. }
  61. if ( ttrm->should_rm()
  62. && ((tterr <= TT_WRN_LAST) || ttrm->force()))
  63. {
  64. int err = ttrm->do_rm();
  65. if (err != 0) {
  66. (void)ttrm->close_tt();
  67. exit( err );
  68. }
  69. }
  70. (void)ttrm->close_tt();
  71. if ((tterr > TT_WRN_LAST) && (! ttrm->force())) {
  72. exit(1);
  73. } else {
  74. exit(0);
  75. }
  76. }