home *** CD-ROM | disk | FTP | other *** search
/ ftp.pasteur.org/FAQ/ / ftp-pasteur-org-FAQ.zip / FAQ / unix-faq / unixware / developer < prev    next >
Encoding:
Text File  |  1997-11-29  |  71.0 KB  |  2,099 lines

  1. Path: senator-bedfellow.mit.edu!bloom-beacon.mit.edu!boulder!csnews!coop.net!su-news-feed4.bbnplanet.com!su-news-hub1.bbnplanet.com!cpk-news-hub1.bbnplanet.com!news.bbnplanet.com!dispose.news.demon.net!demon!news.demon.co.uk!demon!tamarix.demon.co.uk!tamarix!andrew
  2. From: andrew@see.txt.for.addr (Andrew Josey)
  3. Newsgroups: comp.unix.unixware.misc,comp.answers,news.answers
  4. Subject: UnixWare Frequently Asked Questions (Developer)
  5. Followup-To: comp.unix.unixware.misc
  6. Date: Sat, 22 Nov 1997 07:37:54 GMT
  7. Organization: Home.
  8. Sender: news@tamarix.demon.co.uk
  9. Approved: news-answers-request@MIT.EDU
  10. Expires: Mon, 22 Dec 1997 00:00:00 GMT
  11. Message-ID: <EK1EJ6.LH@tamarix.demon.co.uk>
  12. NNTP-Posting-Host: localhost
  13. Summary: Answers to questions frequently asked about SCO's UnixWare SDK
  14. X-NNTP-Posting-Host: tamarix.demon.co.uk [158.152.252.110]
  15. X-Newsreader: TIN [version 1.2 PL2]
  16. Lines: 2080
  17. Xref: senator-bedfellow.mit.edu comp.unix.unixware.misc:25313 comp.answers:29101 news.answers:117756
  18.  
  19. Archive-name: unix-faq/unixware/developer
  20. Posting-Frequency: monthly
  21. Last-modified: June 6, 1997
  22. Version: 2.14
  23.  
  24. UnixWare« Frequently Asked Questions (Developer)
  25.  
  26.  
  27. This is the Developer section of the UnixWare Frequently Asked Questions
  28. file maintained on the Internet for the Usenet newsgroup
  29. comp.unix.unixware.misc. Its maintainer is Andrew Josey
  30. (andrew(a)tamarix.demon.co.uk). Suggestions and contributions are always
  31. welcome.
  32.  
  33. This document and the other FAQ files may be found on the world wide web
  34. at  http://www.freebird.org/faq/
  35.  
  36. This document may also be obtained by anonymous ftp from the freebird
  37. archive at
  38.  
  39.    ftp.freebird.org:/unixware/freebird/hints/FAQ/developer
  40.    ftp1.freebird.org:/pub/mirror/freebird/hints/FAQ/developer 
  41.    ftp2.freebird.org:/pub/unixware/freebird/hints/FAQ/developer 
  42.  
  43. Small print: This file is Copyright 1997 freebird.org. Permission is
  44. granted for copying for non-commercial use. Many proper names of
  45. companies and software mentioned in these files are trademarks of their
  46. respective owners. All views are those of the individual contributors
  47. and not of their employers.
  48.  
  49. This article is posted monthly around the middle of the month. For more
  50. information about the files which compose the total UnixWare FAQ, see
  51. the "FAQ Overview" file posted regularly on the Internet newsgroup
  52. comp.unix.unixware.misc.
  53.  
  54.  
  55. INTRODUCTION
  56.  
  57.  
  58. The Developer section covers aspects of the UnixWare 1.1.x and UnixWare 2.x
  59. SDK.  It also covers general concerns for anyone writing software for the
  60. UnixWare operating system.
  61.  
  62.  
  63.  
  64. TABLE OF CONTENTS
  65.  
  66. D0) How do I get ahold of UnixWare Developer Support?
  67. D1) Is UnixWare  BSD compatible?
  68. D2) Is there a C++ compiler for UnixWare 1.1?
  69. D3) What does the UnixWare 2.0 SDK contain?
  70. D4) Where is the ccs package on UnixWare 2.0?
  71. D5) Where is the documentation for the UnixWare SDK?
  72. D6) What books are there on UnixWare programming?
  73. D7) Where are the man pages for the Standard C functions?
  74. D8) Are there alternative SDKs to the UnixWare SDK for developers?
  75. D9) How do I correctly use the UCB compatibility libraries?
  76. D10) In what library is <undefined symbol> defined?
  77. D11) In what library is regex() and regcmp() defined?
  78. D12) In what library is XmbTextListToTextProperty defined?
  79. D13) What libraries do I need to include for X applications?
  80. D14) What libraries do I need to include for socket applications?
  81. D15) How do I compile the sample Motif applications?
  82. D16) Why do I get memory errors while building applications?
  83. D17) I don't like the new Motif look and feel, How do I get the old one?
  84. D18) How come I keep on getting as_dup proc failures?
  85. D19) How do I get the C compiler to accept C++ style comments?
  86. D20) How do I increase the number of socket connections for my application?
  87. D21) How do I run debug on a SUID root program?
  88. D22) Why do I get Driver without "f" flag not supported?
  89. D23) Why can't I get my SUID root program to work?
  90. D24) Why do I get a symbol error in librpcsvc.a on UnixWare 1.1?
  91. D25) How do I get kdb output to go to a tty?
  92. D26) Why do I have this library dtruntime.so.1 on UnixWare 2?
  93. D27) I included all the necessary libraries, why do I still get unresolved 
  94.      symbols?
  95. D28) How come I can't get some Motif keyboard mappings to work?
  96. D29) Why do I get a bad Makefile from xmkmf on UnixWare 2.0?
  97. D30) How do I get cc to place object files in specific directories?
  98. D31) Why does the open() call block when I try opening the serial port device?
  99. D32) How do I compile tin?
  100. D33) How do I compile emacs?
  101. D34) How do I compile Perl 5?
  102. D35) Where can I get audio software for UnixWare ?
  103. D36) Where can I get the GNU debugger (gdb) for UnixWare 2?
  104. D37) How can I debug an application without the source code?
  105. D38) When I link I can 't find the syslog routines, what should I do?
  106. D39) When I link I can 't find the strcasecmp routine?
  107. D40) When I link I can 't find the alloca routine?
  108. D41) How do I make a pkgmk add-on package?
  109. D42) How to build binaries on UnixWare to run on other SVR4 systems such
  110.    as Solaris x86?
  111. D43) How do I display files open to UnixWare processes? 
  112.  
  113. Subject: D0) How do I get ahold of UnixWare Developer Support?
  114.  
  115.  
  116. The SCO Developer programme can be reached on 1-800-SCO-UNIX in North America,
  117. for the UK and International customers call SCO on +44 1923 816344.
  118.  
  119. As a member of the developer programme you get 5 free technical support
  120. questions among other benefits - see http://www.sco.com/Developers
  121. for info on the Developer programmes.
  122.  
  123. Subject: D1) Is UnixWare BSD compatible?
  124.  
  125. Yes, partially at the source level, No at the binary level.
  126.  
  127. SVR4.0 was created by joint venture with AT&T Bell Labs (then to become
  128. USL) with Sun and SCO.  The result remained very System-V, but what Sun
  129. contributed was the ability to *compile* BSD-based code, even though
  130. there was usually some tweaks necessary regarding libraries to include.
  131.  
  132. You will notice that in both major versions of UnixWare (1.1 and 2.x),
  133. you can use /usr/ucb/cc to envoke the BSD compatible compiler & linker
  134. that knows to link with the BSD-style libraries, which were themselves
  135. compiled from calls to the standard Sys-V libraries (See 
  136. section D9 below).
  137.  
  138. Subject: D2) Is there a C++ compiler for UnixWare 1.1?
  139.  
  140. (Note the ordering information needs to be updated in the
  141. light of the transfer of the UnixWare business to SCO ,
  142. that information has been requested).
  143.  
  144. The C++ Compilation System 2.0 for UnixWare 1.1 is available for the
  145. suggested retail price of U.S. $99 in CD ROM and QIC-24 tape formats.
  146. To order in the U.S.  or Canada, call 1-800-457-1767 or fax (317)
  147. 364-8888.  Outside North America, call +31-55-384279 or fax
  148. +31-55-434455.
  149.  
  150. An alternative is Comeau C++:
  151.  
  152. Comeau C++ 4.0 is a major feature upgrade of Comeau C++, including most
  153. 1996 ANSI/ISO C++ decisions: enhanced templates, exception handling, RTTI,
  154. namespaces, new casts, etc.  Comeau C++ is one of the earliest C++ compilers
  155. and it provides solid and robust fundamental language features.  It is
  156. available for a number of platforms including UNIXWARE, SCO, LINUX, SunOS,
  157. and Solaris.  Comeau is a member of the ANSI/ISO C++ and C committees and
  158. can be reached via sales@comeaucomputing.com, via phone at 718-945-0009 or
  159. through their WEB site at http://www.comeaucomputing.com.   
  160.  
  161. Subject: D3) What does the UnixWare 2.0 SDK contain?
  162.  
  163. 1) C++ compiler with templates (C compiler is part of the AS and PE)
  164. 2) Enhanced Graphical debugger
  165. 3) Motif development tools (sorry, no GUI builder).
  166. 4) Network client/server developer tools {so what's new :-) }.
  167. 5) Online documentation through Dynatext.
  168. 6) Driver development tools including sample driver source.
  169. 7) Integrated window development tools
  170. 8) Software Packaging Tools
  171. 9) Kernel Debugger
  172. 10) Enhanced performance tools and profilers
  173. 11) Multithreaded application development
  174.  
  175. Subject: D4) Where is the ccs package on UnixWare 2.x?
  176.  
  177. The ccs package is no longer a part of the UnixWare SDK, but instead has
  178. been included on the UnixWare AS and PE media.  This is to facilitate
  179. support for third- party SDKs and other software such as databases that
  180. need the C compiler present to function.  Even though this does give you
  181. the C compiler, it does not give you all the components of the SDK such
  182. as the debugger, include files, and miscellaneous static libraries.  So
  183. for a full development environment, an SDK is still considered
  184. essential.
  185.  
  186. Note that you need to install the ccs package from your AS or PE media
  187. prior to installing the SDK, or YOU WILL NOT be able to install the C++
  188. compiler.
  189.  
  190. Subject: D5) Where is the documentation for the UnixWare SDK?
  191.  
  192. UnixWare 2.01 includes all the UnixWare SDK documentation and provides
  193. it through the online documentation system of UnixWare 2.01.  Printed
  194. versions of the SDK Documentation are available in English only from:
  195.  
  196. Hart Graphics for the Novell Fulfillment Department
  197. P.O. Box 141805
  198. Austin, TX, USA 78714-9783
  199.  
  200. Or courier to:
  201.  
  202. Hart Graphics for the Novell Fulfillment Department
  203. 3106 Longhorn Blvd.
  204. Austin, TX, USA 78758
  205.  
  206. Country        Voice                    FAX
  207. Australia      0014-800-128-411    0014-800-124-233
  208. Canada         1-800-366-3892      1-800-826-5399
  209. Singapore      800-1100-073        800-1100-088
  210. U.S.           1-800-336-3892      1-800-826-5399
  211. All others          U.S. Country Code   U.S. Country Code
  212.                +512/834-6905       +512/834-8901
  213.  
  214. Group 6   Basic Software Development    US$ 125.00
  215. Group 7   Networking Development   US$  95.00
  216. Group 8   Windowing Development    US$  95.00
  217. Group 9   C++ Development          US$  55.00
  218. Group 10  IHV Development (drivers)     US$ 115.00
  219. Group 11  OSAPI Reference               US$  95.00
  220. Group 12  NetWare Lib. Ref. for C       US$ 125.00
  221. Group 13  Motif Reference Manual        US$  75.00
  222. Group 14  Additional SDK Reference US$  75.00
  223.  
  224. Note:  These prices do not include Shipping & Handling, or Tax.
  225.  
  226. Subject: D6) What books are there on UnixWare programming?
  227.  
  228. No UNIX programmer should be caught without the Stevens books:
  229.  
  230.   Advanced Programming in the UNIX Environment
  231.   W. Richard Stevens
  232.   Addison-Wesley, 1992
  233.   ISBN 0-201-56317-7
  234.  
  235.   UNIX Network Programming
  236.   W. Richard Stevens
  237.   Prentice Hall, 1990
  238.   ISBN 0-13-949876-1
  239.  
  240. Donald Lewine's POSIX programming guide is also indispensable as a
  241. reference for "which standard defines what API?" kind of questions:
  242.  
  243.   POSIX Programmer's Guide
  244.   Donald Lewine
  245.   O'Reilly and Associates, Inc.
  246.   ISBN 0-937175-73-0
  247.  
  248. You can also checkout Go Solo 2 - The Authorized Guide to Version 2
  249. of The Single UNIX Specification which contains the standard
  250. UNIX manuals (from The Open Group) on CD-ROM in html and PDF
  251. (see http://www.rdg.opengroup.org/unix/gosolo2).
  252.  
  253. Subject: D7) Where are the man pages for the Standard C functions?
  254.  
  255. Just use the man -k command.
  256.  
  257. Subject: D8) Are there alternative SDKs to the UnixWare SDK for developers?
  258.  
  259. Yes, there are many options, and the number is increasing.  The first
  260. option developers generally try is using the GNU gcc compiler and other
  261. GNU tools.  The GNU tools are available from several sources.  The first
  262. place to try is ftp.freebird.org or any of its mirror sites.  Here you can
  263. get packaged binaries.  The second is to get them from a CD-ROM
  264. distribution such as the Prime Time Freeware Tools and Toys for UnixWare
  265. or the Walnut Creek SVR4 (UnixWare) CD-ROM.  These CDs include many
  266. useful utilities that any developer would find handy.  The third is to
  267. get source from the Free Software Foundation or any of the many CD-ROMs
  268. and build the binaries yourself.
  269.  
  270. Scott Raney <raney@metacard.com> writes:
  271.  
  272. MetaCard is a complete GUI development environment that includes a
  273. graphical interface builder and a high-performance VHLL (Very High
  274. Level Language).  With MetaCard both novice and professional
  275. developers can build graphical applications more rapidly than is
  276. possible with other tools.  Email info@metacard.com or see
  277. http://www.metacard.com for more information.
  278.  
  279. There are many third party compilers available for UnixWare, and if the
  280. vendors contact me I will include them in the FAQ.
  281.  
  282. Subject: D9) How do I correctly use the UCB compatibility libraries?
  283.  
  284. There are two problems that are typically encountered when
  285. compiling/linking code that uses Berkley-isms:
  286.  
  287. * Undefined symbols at link time
  288. * Incompatibilities between the SysV header files and the UCB libraries
  289.  
  290. C code using Berkley-isms such as index/rindex will generate "undefined
  291. symbol" messages for each of the BSD-specific functions.  To get around
  292. this, you have one of two options:
  293.  
  294. * Option A: Straight UCB compile
  295.    
  296.    Compile with the "UCB" compiler (/usr/ucb/cc).  This is actually a shell
  297.    script wrapper around the standard C compiler (/usr/ccs/bin/cc) that 
  298.    sets up the necessary #include and library paths.  This is the path to
  299.    take if you want a more "pure" BSD environment for your development.
  300.  
  301. * Option B: SysV compile with Berkeley extensions
  302.    
  303.    If you want a SysV environment, but need to link in some functions
  304.    only available in the BSD library (eg, you'll replace gethostname() with
  305.    uname() later), simply link in the UCB libraries _after_ the standard
  306.    (SysV) libraries.  For example:
  307.  
  308.      cc -o foo foo.c -lc -L /usr/ucblib -lucb
  309.  
  310. Note the order of the library specifications, and that "-lc" should
  311. precede the UCB library specification to resolve all possible synonyms
  312. against the SysV library, rather than the BSD library.
  313.  
  314. Be careful exercising option (b), however.  Merely linking against the
  315. UCB library, without the preceding "-lc", will cause code to be compiled
  316. against the SysV #include files (located in /usr/include) and then
  317. linked against the UCB libraries:
  318.  
  319.     cc -o foo foo.c -L /usr/ucblib -lucb  # Don't do this
  320.  
  321. (Note that an implicit "-lc" is appended to the command line.)
  322. Differences in such things as structure sizes between the SysV #includes
  323. and the UCB libraries can wreak all kinds of havoc - as Jim Vlcek
  324. discovered in just this fashion when trying to use setjmp in a source
  325. module that also called some UCB functions.  One way to get around this
  326. is to insert a "-I /usr/ucbinclude" directive into the command line, but
  327. this is essentially the effect of using /usr/ucb/cc.
  328.  
  329.  
  330. Gordon W. Ross <gwr@mc.com> wrote:
  331.  
  332.   I just wanted to mention here that most people I have helped with
  333.   porting problems related to the dirent or directory libraries have
  334.   caused their own problems by incorrectly using the UCB library.
  335.   The directory(3) routines in the UCB library only work with the
  336.   header files in /usr/ucbinclude so if you fail to put that in
  337.   your include path and just link with -lucb you end up with
  338.   seriously broken programs.  The stuff in /usr/ucbinclude/ and
  339.   /usr/ucblib/ was meant to be used by /usr/ucb/cc only, and
  340.   when used that way it (mostly) works.  I have usually found it
  341.   easiest to just stay away from the UCB library entirely.
  342.   I would advise others to do the same.  (The UCB library has
  343.   well known problems in signal and some dbm functions.)
  344.  
  345. Robert Withrow (witr@rwwa.com) wrote:
  346.  
  347.   In addition, checking the following things will almost always yield a
  348.   working port for any reasonably `well behaved program':
  349.  
  350.   1 Replace bcopy et.al with the apropriate memcpy functions...
  351.  
  352.   #define bcopy(b1,b2,len) memmove((b2), (b1), (size_t)(len))
  353.   #define bzero(b,len) memset((b), 0, (size_t)(len))
  354.   #define bcmp(b1,b2,len) memcmp((b1), (b2), (size_t)(len))
  355.  
  356.   2 Replace index and rindex approprately:
  357.  
  358.   #define index(a,b) strchr((a),(b))
  359.   #define rindex(a,b) strrchr((a),(b))
  360.  
  361.   3 Don't use the SVR4 library's signal() routine,
  362.   [use sigaction instead ...]
  363.  
  364.   /* Reliable signals */
  365.   /* This was taken from Stevens... */
  366.  
  367.   #include <signal.h>
  368.  
  369.   typedef void Sigfunc(int);
  370.  
  371.   Sigfunc *signal(int signo, Sigfunc *func)
  372.   {
  373.     struct sigaction act, oact;
  374.  
  375.     act.sa_handler = func;
  376.     sigemptyset(&act.sa_mask);
  377.     act.sa_flags = 0;
  378.     if (signo != SIGALRM) {
  379.       act.sa_flags |= SA_ESTART;
  380.     }
  381.     if (sigaction(signo, &act, &oact) < 0)
  382.       return(SIG_ERR);
  383.     return(oact.sa_handler);
  384.   }
  385.  
  386.   4 Replace random with lrand
  387.  
  388.   #define random() lrand48()
  389.   #define srandom(seed) srand48((seed))
  390.  
  391.   5 Replace the bsd readdir code with the Posix code (requires changing an
  392.   include file and a declaration usually, but also perhaps a symbol with a 
  393.   strlen.)
  394.  
  395.   6 Replace wait3 and wait4 with posix wait code.  This is complicated
  396.   because some code *writes* into the values that posix only provides read 
  397.   access to.
  398.  
  399.  
  400. Rick Richardson (rick@digibd.com) wrote:
  401.  
  402.   Its much easier to port stuff than most people think.
  403.  
  404.   I've found that 99.99% of applications with BSDisms can be ported
  405.   by simply compiling normally, but linking with -lc -lucb.  This
  406.   resolves the SVR4 C library first, avoiding problems with dirent
  407.   and the like, but also lets you pick up any BSD-isms like
  408.   random(), index(), etc.
  409.  
  410.   Really, its painless.
  411.  
  412. Other advice for porting applications :
  413.  
  414. What to use instead of gethostname, getdtablesize, getpagesize?
  415.  
  416. (a) gethostname
  417.  
  418. This can be replaced by using the sysinfo(2) routine.
  419.  
  420. #include <sys/systeminfo.h>
  421.  
  422.         ....
  423.  
  424.         char buf[MAXHOSTNAME];
  425.  
  426. /* BSD code was: */
  427. /* if (gethostname(buf, sizeof(buf)) < 0) { */
  428.  
  429. if (sysinfo (SI_HOSTNAME, buf, sizeof(buf)) < 0) {
  430.         perror("SI_HOSTNAME);
  431.         exit(ERROR);
  432. }
  433.  
  434. (b) getdtablesize
  435.  
  436. This can be replaced by the sysconf(2) routine
  437.  
  438. #include <unistd.h>
  439.  
  440.         ....
  441.         long tablesize;
  442.  
  443. #ifdef _SC_OPEN_MAX    /* POSIX define*/
  444.         tablesize = sysconf (_SC_OPEN_MAX);
  445. #else /* BSD code */
  446.         tablesize = getdtablesize();
  447. #endif
  448.  
  449. (c)  getpagesize
  450.  
  451. This can be replaced with a call to sysconf(2)
  452.  
  453. #include <unistd.h>
  454.  
  455.         ....
  456.         long pagesize;
  457.  
  458. #ifdef _SC_PAGE_SIZE    /* X/Open define*/
  459.         pagesize = sysconf (_SC_PAGE_SIZE);
  460. #else /* BSD code */
  461.         pagesize = getpagesize();
  462. #endif
  463.  
  464.  
  465.  
  466.  
  467. Subject: D10) In what library is <undefined symbol> defined?
  468.  
  469. The command 'nm' can be used to examine the contents of library files,
  470. or use the following script to automate the process.
  471.  
  472. --- Cut here and save to "who_defines", then "chmod +x who_defines"---
  473. #!/bin/sh
  474. if [ $# -ne 1 ]
  475. then
  476.         echo "Usage: who_defines function_name" >&2
  477.         exit 1
  478. fi
  479.  
  480. # You may need to add library directories to this list.
  481.  
  482. LIBDIRS="
  483.         /usr/lib
  484.         /usr/ccs/lib
  485.         /usr/X/lib
  486.         /usr/ucblib"
  487.  
  488. for dir in $LIBDIRS
  489. do
  490.         for lib in $dir/*.a $dir/*.so
  491.         do
  492.                 if [ -r "$lib" ]
  493.                 then 
  494.                         nm -px $lib | sed -n '/T \<'$1'\>/p' 2>/dev/null |
  495.                         while read ans
  496.                         do
  497.                                 echo $lib:$ans
  498.                         done
  499.                 fi
  500.         done
  501. done
  502. --- End of "who_defines" ---
  503.  
  504.  
  505. To determine where a symbol (eg, bind) is defined:
  506.  
  507.   % who_defines bind
  508.   /usr/lib/libsocket.a:0x000000c0 T bind
  509.   /usr/lib/libsocket.so:0x00008050 T bind
  510.  
  511. Note that, as above, you will often get multiple answers.  Here, we see
  512. that bind itself is in the socket directory (the .a and .so are the
  513. static and dynamic libraries, respectively).  The library name is the
  514. path that precedes the colon; your ld command line should thus include
  515. the entry:
  516.  
  517.   -lsocket
  518.  
  519.  
  520. Subject: D11) In what library is regex() and regcmp() defined?
  521.  
  522. The functions regex() and regcmp() are located in the general function library
  523. /usr/ccs/lib/libgen.a and can be included by using the option -lgen to cc.
  524.  
  525. Subject: D12) In what library is XmbTextListToTextProperty defined?
  526.  
  527. This function as well (as the function XmbTextPropertyToTextList()) is
  528. defined in the library /usr/X/lib/libXIM.so on UnixWare 1.1.  This
  529. should not be a problem on UnixWare 2.0.
  530.  
  531. Subject: D13) What libraries do I need to include for X applications?
  532.  
  533. This is how the sample application periodic was linked:
  534.  
  535. $ cc -o periodic periodic.o -O -Xa  -T 0x8300000 -L//usr/X/lib
  536. /usr/X/lib/libMrm.so /usr/X/lib/libXm.so -lXt -lXext -lX11  -lgen  -lnsl
  537. -z nodefs
  538.  
  539.  
  540. Subject: D14) What libraries do I need to include for socket applications?
  541.  
  542. Socket applications need to include the sockets library and the
  543. networking support library:
  544.  
  545. $ cc -o foo foo.c -lsocket -lnsl
  546.  
  547. Subject: D15) How do I compile the sample Motif applications?
  548.  
  549. The simple way to compile one of the sample Motif applications is to
  550. first copy it to some local working directory to avoid permission errors
  551. on the files:
  552.  
  553. $ cp -r /usr/X/lib/motifdemos/periodic periodic
  554.  
  555. Then cd into the periodic directory:
  556.  
  557. $ cd periodic
  558.  
  559. Run xmkmf to convert the Imakefile into a Makefile (See D29 first):
  560.  
  561. $ xmkmf
  562. imake -DUseInstalled -I/usr/X/lib/config
  563.  
  564. Then run make:
  565.  
  566. $ make
  567.         /bin/rm -f periodic.o
  568.         cc -c -O -Xa -I. -I./X11 -I./X11 -I///usr/X/include 
  569. -I///usr/X/include/X11
  570. -I/usr/include -I//usr/X/include -I. -DSVR4 -DSYSV386 -DI18N
  571. -DFUNCPROTO=15 -DNARROWPROTO -DLIBDIR=\"/usr/X/lib\"
  572. -DDESTDIR=\"/usr/X\"  periodic.c
  573.         /bin/rm -f periodic
  574.         cc -o periodic periodic.o -O -Xa  -T 0x8300000 -L//usr/X/lib 
  575. /usr/X/lib/libMrm.so /usr/X/lib/libXm.so -lXt -lXext -lX11  
  576. -lgen  -lnsl  -z nodefs
  577.  
  578. Then run:
  579.  
  580. $ ./periodic
  581.  
  582. Subject: D16) Why do I get memory errors while building applications?
  583.  
  584. The first potential problem is running into user process limits which
  585. are controlled by the following tunables:.
  586.  
  587.      SDATLIM
  588.      HDATLIM
  589.      SSTKLIM
  590.      HSTKLIM
  591.      SVMMLIM
  592.      HVMMLIM
  593.  
  594. These may need to be increased so that enough memory resources are
  595. available to build very large applications.
  596.  
  597. The second potential problem could be a lack of swap space.  This can be
  598. checked by using the swap command.  Remember that swap is a dynamic
  599. thing so just running the swap command after a failed compile does not
  600. tell the story of what is happening during the compile.  On UnixWare 2,
  601. you can use the real time performance monitor (rtpm) or the GUI System
  602. Monitor to watch what is going on.  More swap can be added by swapping
  603. to a file which should be covered in the administration FAQ.
  604.  
  605. On UnixWare 2.0, there is also the possibility that you are running out
  606. of /tmp file space since this defaults to a memfs.  Since the compiler
  607. heavily uses /tmp, this filesystem may need to be increased by editing
  608. the /etc/vfstab file entry for /tmp, or not using a memfs for /tmp at
  609. all.
  610.  
  611. Subject: D17) I don't like the new Motif look and feel, How do I get the old
  612. one?
  613.  
  614. Some developers have expressed the desire to have Motif version 1.2.3
  615. under UnixWare 2.0 have the older look and feel of Motif version 1.2.2. 
  616. Following is a developers note:
  617.  
  618. > ... the look and feel of the XmToggleButton
  619. > is vastly different under UW 2.0 than those of the standard
  620. > Motif version.  The XmToggleButton in radio mode is a round
  621. > circle instead of the standard diamond shape.  The non-radio
  622. > mode XmToggleButton displays a check mark inside the square
  623. > under UW 2.0.  IMHO this is ugly.
  624.  
  625. This is the standard look and feel for CDE. Sun, HP, IBM, DEC, Novell,
  626. Fujitsu, Hitachi, and other vendors are or will soon be shipping this
  627. same Motif (same source code). While UnixWare 2.0 does not include the
  628. CDE desktop, it does include the CDE Motif implementation.
  629.  
  630. Furthermore, this user interface design change was in response to
  631. _significant_ user complaints about the old look. Hundreds of users have
  632. complained that the old visuals were not visibly distinctive, leaving
  633. them unsure which toggles were set and which were not. The new visuals
  634. are decidedly better, in the humble opinion of customers, user interface
  635. designers, and the vendors shipping CDE.
  636.  
  637. > The question I have is
  638. > WHY OH WHY did Novell do this type of thing?  The Motif look
  639. > and feel is supposed to be standard across all platforms.
  640. > What Novell did to Motif is gratuitous, and a disservice to
  641. > the efforts of a standard.
  642.  
  643. Nope, just the opposite. We participated in the standards activities
  644. that lead to this change.
  645.  
  646. In any case, one can get the old look (diamonds, no-checks) by setting
  647. these resources:
  648.  
  649. *enableToggleVisual: false    # use the diamond/empty-square visuals
  650. *enableToggleColor:  false    # use "select" color, instead of highlight color
  651.  
  652. This will restore the original, hard-to-distinguish visuals.
  653.  
  654. The complete set:
  655.  
  656. *enableToggleVisual:     {true|false}
  657.        # use the diamond/empty-square visuals
  658.  
  659. *enableToggleColor: {true|false}
  660.        # use "select" color, instead of highlight color for selected toggles
  661.  
  662. *enableBtn1Transfer:     {button2_transfer|true|false}
  663.        # true == Button 2 is ADJUST, Button 1 is TRANSFER
  664.        # button2_transfer, Button 2 is TRANSFER, Button 1 is drag and drop
  665.  
  666. *enableButtonTab:   {true|false}
  667.        # TAB moves among pushbuttons in tab groups, e.g.  Apply/Reset/Cancel
  668.  
  669. *enableDefaultButton:    {true|false}
  670.        # shows button highlight inside the default-ring on the default button
  671.  
  672. *enableDragIcon:    {true|false}
  673.        # uses better default icons (visuals) for drag and drop
  674.  
  675. *enableEtchedInMenu:     {true|false}
  676.        # shows menu buttons as "pressed in" rather than "pushed out"
  677.  
  678. *enableMenuInCascade:    {true|false}
  679.        # can use the Button 3 to pull down menus on menu bars
  680.  
  681. *enableMultiKeyBindings:{true|false}
  682.        # enable use of additional key bindings (e.g. Sun's Cut/Copy/Paste)
  683.  
  684. In all cases, a value of "false" gets the original (old) Motif behavior.
  685. For UW 2.0, the default .Xdefaults file gives "true" for all these,
  686. except the third ("button2_transfer").
  687.  
  688. Subject: D18) How come I keep getting as_dup proc failures?
  689.  
  690. UnixWare 1.1:
  691.  
  692. These errors are generally caused by memory problems (as opposed to
  693. newproc pid_assign errors, which are generally due to low values of the
  694. NPROC and MAXUP tunables).  These errors could be caused by insufficient
  695. RAM, swap space or by processes which take up too much memory.
  696. Processes which do many time calls may be prone to the localtime memory
  697. leak and might get very large and thus take up a lot of memory.  Also,
  698. processes which do successive mallocs and frees may be prone to a
  699. problem with free (where memory does not get correctly returned to the
  700. system) and may also get very large and use too much memory.
  701.  
  702. To find whether there are processes running which have grown too large,
  703. enter:
  704.  
  705.     ls -l /proc
  706.  
  707. This will list all processes (by pid) and how much memory they take.
  708.  
  709. Aside from adding more RAM or swap, if there are processes which are
  710. taking up an inordinately large amount of memory, try applying PTF174
  711. (localtime memory leak) and/or PTF161 (problem with free).  These ptf's
  712. contain updates to shared object libraries and thus they should be able
  713. to be applied to the run-time system.  The app should not have to be
  714. re-compiled.
  715.  
  716. NOTE:  ptf174 is contained in Update 1.1.3.
  717.  
  718. UnixWare 2.0:
  719.  
  720. I have never heard of anyone getting this under UnixWare 2.0, but the
  721. same memory problems would be at fault.
  722.  
  723. Subject: D19) How do I get the C compiler to accept C++ style comments?
  724.  
  725. By supplying the following options on the cc command line, you can get
  726. cc to accept C++ style comments:
  727.  
  728.      cc -W0,-B foo.c
  729.  
  730. Subject: D20) How do I increase the number of socket connections for my
  731. application?
  732.  
  733. UnixWare 1.1:
  734.  
  735. To do this you first must edit the /etc/conf/sdevice.d/sockmod system
  736. file and increase the number in the third field.  Normally this defaults
  737. to 128.  The system maximum for this is about 256 connections due to a
  738. limitation in the library libc.so.  After this value has been increased,
  739. the kernel must be rebuilt and the system rebooted.  Also, the kernel
  740. tunable NUMTIM might need to be increased to allow for the greater
  741. number of streams modules required by the socket interface.  For every
  742. socket connection opened there is an associated file descriptor.  If the
  743. user executes the command 'ulimit -a' he/she will see that this defaults
  744. to 64.  In order to get more than 64 connections the associated tunables
  745. SFNOLIM and HFNOLIM must be increased.  Because of the limitations in
  746. the library libc that were described previously, there isn't much need
  747. to increase this beyond 256.  There is an upper limit to the number of
  748. connections allowed due to kernel memory allocation limitations.  Kernel
  749. memory must exist in the less than 16MB memory range due to
  750. historical/architectural reasons.  This means that the kernel image,
  751. drivers, and kernel buffers (including streams buffers) live in the less
  752. than 16MB memory range.  This creates the limitation on the number of
  753. connections based on how much memory can be acquired to maintain these
  754. connections.  This has implications for machines with less than 16 MB of
  755. RAM, i.e., more RAM may be necessary to increase the number of
  756. connections.  I was successful in getting 197 socket connections, and
  757. had a developer get around 230.
  758.  
  759. Now with the number of connections increased, if the applications being
  760. run are things such as telnet or ftp, the /etc/inet/inetd.conf
  761. configuration needs to be such that the required number of server
  762. daemons can be  started such as in.telnetd or in.ftpd.
  763.  
  764. Note: after the initial release of this TID, I have had some developers
  765. in Novell USG state that they believe there should not be a limitation
  766. in the number of connections through libc.  So it may be possible to
  767. increase this to a value greater than 256.
  768.  
  769. UnixWare 2.0:
  770.  
  771. There are several causes that lead to not having enough socket connections:
  772.  
  773. 1) The ulimit values may be limiting the number of open files allowed.
  774. 2) For UNIX Domain sockets, the third field in
  775. /etc/conf/sdevice.d/ticots is set too low.
  776.  
  777. 3) For Internet Domain sockets, the third field in
  778. /etc/conf/sdevice.d/tcp is set too low.
  779.  
  780. First, increase the number of open files a process is allowed to have by
  781. tuning the SFNOLIM system tunable.  This can be done using the System
  782. Tuner in the Admin_Tools folder on the desktop.  (This value can also be
  783. increased temporarily by typing "ulimit -n unlimited" as root.)
  784.  
  785. Second, for UNIX Domain sockets, increase the number in the third field
  786. of /etc/conf/sdevice.d/ticots.  Rebuild this module by typing "idbuild
  787. -M ticots".  For Internet Domain sockets, increase the number in the
  788. third field of /etc/conf/sdevice.d/tcp.  Rebuild this module by typing
  789. "idbuild -M tcp".
  790.  
  791. Reboot the system.
  792.  
  793. Note:  For this I increased the values to 1024, there appears to be no
  794. upper limit on how many connections there can be.
  795.  
  796. Subject: D21) How do I run debug on a SUID root program?
  797.  
  798. When trying to run debug on a setuid program, the following error
  799. message appears:
  800.  
  801.     System error attempting to control process <pid>
  802.     Create failed: all resulting processes killed
  803.  
  804. This happens whether debug is run by the program owner (usually root) or
  805. not.  debug cannot be run by someone other than the program owner
  806. (usually root) because then the person running the program could make
  807. modifications to the program which are not explicitly allowed by
  808. setuid.
  809.  
  810. The graphical version of debug cannot be run by the program owner
  811. (usually root) because this person is generally not the same person
  812. whose desktop debug will try to display on.  By default, X does not
  813. allow one user to display windows on another person's desktop.
  814.  
  815. To run the graphical version of debug on a setuid program:
  816.  
  817.     1)  xhost +
  818.  
  819. (This allows other users to display windows on your desktop).
  820.  
  821.     2)  su to the person who owns the setuid program.
  822.  
  823.     3)  run debug on the program.
  824.  
  825. Subject: D22) Why do I get Driver without "f" flag not supported?
  826.  
  827. This driver probably has a version 0 Master file and does not have an
  828. "f" in the characteristics field (see man (4) Master).  This means that
  829. this driver is not a DDI/DKI compliant driver, and thus will not work on
  830. UnixWare 2.0.
  831.  
  832. The solution is to modify the driver to be DDI/DKI compliant.  This will
  833. also guarantee that the driver will work on future releases of UnixWare.
  834. Consult the Device Driver Reference Manual (DDI/DKI) in the Dynatext
  835. Browser.  It gives good detail on what is needed to be compliant, what
  836. is supported, and what is not supported.
  837.  
  838. NOTE:  We stated that UnixWare 1.1 drivers will run on UnixWare 2.0.
  839. The actual situation is that DDI/DKI compliant 1.1 drivers (drivers
  840. written for 1.1) will work on 2.0.  The problem is that 1.1 supported a
  841. lot of older driver interfaces, but this support is not in 2.0.
  842. Developers need to become DDI/DKI compliant.
  843.  
  844. Subject: D23) Why can't I get my SUID root program to work?
  845.  
  846. The common situation is that a developer has a SUID application (The
  847. effective user ID bit set) for a root owned application and it is unable
  848. to locate dynamic libraries at runtime.  The error would be something
  849. like:
  850.  
  851. dynamic linker : xapplication : error opening libX11.so
  852. Killed
  853.  
  854. This is common if the SUID root application is an X application.
  855.  
  856. This is a deliberate action to prevent a problem with security.  If the
  857. dynamic linker did not cause this to break on SUID programs a potential
  858. security hole would occur.  The security hole would be in the form that
  859. the SUID program would use the LD_LIBRARY_PATH to search for dynamic
  860. libraries needed.  In a SUID program that path must be static.  If the
  861. library were located using the LD_LIBRARY_PATH then a user could
  862. potentially create his own library that mimics a well known library. 
  863. This "imposter" library could have a deliberate security hole in it.
  864. When the application tried to locate a library such as libX11.so and
  865. went to the user's imposter library by using the LD_LIBRARY_PATH, the
  866. security would have been compromised since the application may be owned
  867. by root.
  868.  
  869. To prevent this security problem, SUID applications must have the path
  870. to all libraries statically included.  To do this the developer needs to
  871. set the LD_RUN_PATH to point to all libraries needed by that application
  872. prior to linking.  By default SUID applications search for libraries in
  873. /usr/lib, but if the application is an X application, all the X
  874. libraries are in /usr/X/lib and these libraries would not be located if
  875. the LD_RUN_PATH environment variable was not set prior to linking.
  876.  
  877. Subject: D24) Why do I get a symbol error in librpcsvc.a on UnixWare 1.1?
  878.  
  879. This library has a symbol table problem.  When trying to link to the library
  880. librpcsvc.a, the developer gets an error that this library is corrupt.
  881.  
  882. This library can be fixed by running the 'ar' command on it as root.
  883.  
  884. # ar -sr /usr/lib/librpcsvc.a
  885.  
  886. Subject: D25) How do I get kdb output to go to a tty?
  887.  
  888. The kdb command 'newterm' will let you change a kdb session to a tty.
  889. All subsequent kdb sessions will then go to this same tty.  Just make
  890. sure there is a ttymon active on the tty before you do this.
  891.  
  892. The syntax on UnixWare 2.0 is "newterm <driver> <minor #>", so for
  893. example "newterm iasy 2" will send output to /dev/tty01.  For UnixWare
  894. 1.1 the syntax is a little different, but the effect is the same.
  895.  
  896. Another option which will force all console output to another device is
  897. to edit the /stand/boot file and use the console parameter to indicate
  898. another device.  See the man page for boot(4) for parameter details and
  899. the man page for boot(1) for information on the boot file itself.
  900.  
  901. Subject: D26) Why do I have the library dtruntime.so.1 on UnixWare 2?
  902.  
  903. Developers have noticed that several of the standard X libraries are
  904. symbolically linked to the library /usr/X/desktop/dtruntime.so.1.  What
  905. is the reasoning behind this?
  906.  
  907. The reason for this library is as follows:
  908.  
  909. 1)  dtruntime is a library that is the combination of many of the X libraries
  910.  
  911. 2)  This was done to speed up X programs.  It accomplishes this 2 ways:  the
  912.     run-time linker has to do much, much less work at startup to resolve
  913.     symbols and locality tuning is more effective on one large object (as
  914.     opposed to many small ones) since there is a high correlation between
  915.     references to multiple libraries (e.g. Xtfunc always calls Xfunc).
  916.  
  917. 3)  There is no wasted space on a run-time system (a system with no SDK). 
  918.     Simply, many libraries are link-edited to one and links are made to the
  919.     individual names.  On a system with the SDK installed, 3 MB is wasted,
  920.     since we can't link the run-time libraries to the build libraries (i.e. 
  921.     ZZZ.so.1 -> ZZZ.so).
  922.  
  923. 4)  Any programmer who uses the SDK will not see dtruntime unless he/she is
  924.     doing ls's around /usr/X (see #5).
  925.  
  926. 5)  One's binaries still say that the program requires libXt.so.5.0 to run. 
  927.     It just happens to be that on our system, this file is a link to
  928.     dtruntime.
  929.  
  930.     In fact, we took great effort in not "exposing the implementation"
  931.     so that executables will never be dependent on dtruntime and the ABI 
  932.     is not violated.
  933.  
  934. 6)  Some have commented "what a hack".  
  935.     
  936.     This is, actually, an unhack.  Novell realized that the illusion
  937.     of separate libraries was just that . . . so we put them together.  The
  938.     beauty of the idea is that we can unlink the libraries at any time if
  939.     there was a reason to do so (see #5).
  940.  
  941. Subject: D27) I included all the necessary libraries, why do I still get
  942. unresolved symbols?
  943.  
  944. Some developers have noticed that while linking an application on
  945. UnixWare with the correct libraries, they still get unresolved symbols. 
  946. The libraries are even verified with the 'nm' command to contain the
  947. needed symbols.
  948.  
  949. It has been noted that how files are specified on the cc command line
  950. affects what libraries are searched and included.
  951.  
  952. The following command line will not work:
  953.  
  954.         $ cc -lsocket -lnsl -lgen -o main.o main.c
  955.  
  956. Where this one will:
  957.  
  958.         $ cc -o main.o main.c -lsocket -lnsl -lgen
  959.  
  960. Note that the libraries must be specified last.  The reason for this is
  961. because the first few options go to the C compiler, where the last
  962. options go to the linker.  Before someone states that this is broke,
  963. this is actually done to be SVID/ABI compliant.
  964.  
  965. Subject: D28) Why can't I get some Motif keyboard mappings to work?
  966.  
  967. A Developer had an application that remapped keys on the keyboard in the
  968. defaults file located in /usr/X/lib/app-defaults under UnixWare 1.1.3
  969. and it worked fine.  When moved to UnixWare 2.01, the application can no
  970. longer map the keys correctly.
  971.  
  972. The problem here is that in going from UnixWare 1.x to UnixWare 2.x the
  973. Motif library changed from 1.1 to 1.2.  With this library change, the
  974. concept of Virtual Key bindings was introduced which adds a level of
  975. abstraction between actual Key events and what applications act on.
  976. Client side generated osfXXX key events are then translated to actual
  977. key events at the Server level.
  978.  
  979. When an application overloads Raw Key events, there's no guarantee that
  980. Motif will not overload those.
  981.  
  982. In a test program I was able to overload <Key>Home and <Key>End with no
  983. problem but could not overload <Key>Insert.  Changing the <Key>Insert to
  984. <Key>osfInsert worked fine. In general the application should overload
  985. the osfXXX events instead.
  986.  
  987. The developer needs to modify the translation table to overload
  988. <Key>osfInsert <Key>osfBeginLine and <Key>osfEndLine instead of the
  989. <Key>Insert, <Key>Home and <Key>End translations.
  990.  
  991. Subject: D29) Why do I get a bad Makefile from xmkmf on UnixWare 2.01?
  992.  
  993. During the building of periodic in the /usr/X/lib/motifdemos/periodic
  994. directory, I get these problems:
  995.  
  996. $ cd periodic
  997. $ ls -l
  998. total 130
  999. -r--r--r--    1 darrend  other        984 Jun 22 10:50 Imakefile
  1000. -r--r--r--    1 darrend  other       1127 Jun 22 10:50 Periodic.ad
  1001. -r--r--r--    1 darrend  other      18137 Jun 22 10:50 periodic.c
  1002. -r--r--r--    1 darrend  other      35962 Jun 22 10:50 periodic.uil
  1003. -r--r--r--    1 darrend  other       7381 Jun 22 10:50 periodic_local.uil
  1004. $ xmkmf
  1005. imake -DUseInstalled -I/usr/X/lib/config
  1006. $ make
  1007.         /bin/rm -f periodic.o
  1008.         cc -c -O -Xa -I. -I./X11 -I./X11 -I///usr/X/include 
  1009. -I///usr/X/include/X
  1010. 11 -I/usr/include -I//usr/X/include -I. -DSVR4 -DSYSV386 -DI18N  
  1011. -DFUNCPROTO=15
  1012.  -DNARROWPROTO -DLIBDIR=\"/usr/X/lib\" -DDESTDIR=\"/usr/X\"  periodic.c
  1013.         /bin/rm -f periodic
  1014.         cc -o periodic periodic.o -O -Xa  -T 0x8300000 -L//usr/X/lib  
  1015. ./lib/Mrm/libMrm.so ./lib/Xm/libXm.so -lXt -lXext -lX11  -lgen  -lnsl  
  1016. -z nodefs
  1017. UX:ld: ERROR: ./lib/Mrm/libMrm.so: fatal error: cannot open file for reading
  1018. *** Error code 1 (bu21)
  1019. UX:make: ERROR: fatal error.
  1020. $
  1021.  
  1022. It appears that the Motif templates file in /usr/X/lib/config is
  1023. incorrect.  You can get imake or xmkmf to work correctly if you fix the
  1024. file /usr/X/lib/config/Motif.tmpl with the following corrections.
  1025.  
  1026. Change:
  1027.     MTOOLKITSRC = $(LIBSRC)/Xt
  1028.      MWIDGETSRC = $(LIBSRC)/Xm
  1029.    MRESOURCESRC = $(LIBSRC)/Mrm
  1030.  
  1031. To:
  1032.     MTOOLKITSRC = /usr/X/lib
  1033.      MWIDGETSRC = /usr/X/lib
  1034.    MRESOURCESRC = /usr/X/lib
  1035.  
  1036. I suggest that you comment out the old lines like this:
  1037. /*    MTOOLKITSRC = $(LIBSRC)/Xt */
  1038. /*     MWIDGETSRC = $(LIBSRC)/Xm */
  1039. /*   MRESOURCESRC = $(LIBSRC)/Mrm */
  1040.  
  1041. Note also that you will get a permissions error if you try to build this
  1042. application in that directory.  I suggest making a local copy, as root
  1043. does not have the necessary environment for building this application
  1044. (No X references).
  1045.  
  1046. Subject: D30) How do I get cc to place object files in specific directories?
  1047.  
  1048.  
  1049. Developers using the C compiler cc need to place object files in
  1050. specific directories.  Note that this feature is supported by some third
  1051. party compilers, e.g.
  1052.  
  1053.         $ cc -c darren.c -o /tmp/darren.o
  1054.  
  1055. The SVID definition states that the -o option only applies to the
  1056. linker.  Since using the -c option means the linker is never called,
  1057. this option will not work.
  1058.  
  1059. There is a workaround using the -Wa option to the compiler (see the cc
  1060. man page.)
  1061.  
  1062.         $ cc -c darren.c -Wa,'-o/tmp/darren.o'
  1063.  
  1064.  
  1065. Note that I did not put a space after the -o option.
  1066.  
  1067. Subject: D31) Why does the open() call block when I try opening the serial 
  1068.    port device?
  1069.  
  1070. The general symptoms of this problem are:
  1071.  
  1072. 1) I try to open the serial port device and the open() call blocks.
  1073.  
  1074. 2) How can I bypass this insistence on having a modem carrier when I am not
  1075. talking to a modem?
  1076.  
  1077. 3) I don't want O_NOBLOCK behavior for my serial device.
  1078.  
  1079.  
  1080. One solution involves making a special serial cable as follows:
  1081.  
  1082.     You could loop 6, 8 and 20 at the Unix end to assert DCD.
  1083.  
  1084.  
  1085. Another solution involves opening the driver non-blocking.  There is an
  1086. O_NDELAY flag or an O_NOBLOCK flag to open() which causes the open call
  1087. to succeed without waiting for carrier detect to be asserted. If you use
  1088. either of these modes,  you can turn off the non blocking behavior,
  1089. since this is not the operating mode you may desire for the subsequent
  1090. read() and write() calls.
  1091.  
  1092. You use fcntl() after open() to turn off O_NDELAY (error checks omitted):
  1093.  
  1094.     fd = open ( "/dev/tty01h", O_RDWR | O_NDELAY );
  1095.     flags = fcntl ( fd, F_GETFL );
  1096.     fcntl ( fd, F_SETFL, flags & ~O_NDELAY );
  1097.  
  1098.  
  1099. Subject: D32) How do I compile tin?
  1100.  
  1101. This should by now be a classic problem in compiling tin under UnixWare
  1102. (1.0 at least, I don't know if 1.1 fixed this particular bug).
  1103.  
  1104. When you're compiling tin, the make may fail on the first source file
  1105. with messages like the following:
  1106.  
  1107. "/usr/include/sys/termios.h", line 503: (struct) tag redeclared: winsize
  1108. active.c, line 615: warning: argument is incompatible with prototype: arg #4
  1109. active.c, line 616: warning: argument is incompatible with prototype: arg #4
  1110. make: fatal error.
  1111.  
  1112. If this occurs, you've encountered a bug in one of the UnixWare system
  1113. header files.  You can do one of two things to compile tin under
  1114. UnixWare:
  1115.  
  1116. * Fix the header file.  Change all occurrences of
  1117.  
  1118.     _IO_PT_PTEM_H
  1119.  
  1120.    to
  1121.  
  1122.     _IO_PTEM_H
  1123.  
  1124.    in the file /usr/include/sys/ptem.h.
  1125.  
  1126. <or>
  1127.  
  1128. * Hack the tin header file tin.h, which is what I did.  At line 130 in 
  1129.    tin.h, you'll find two #include directives, <sys/ptem.h> and 
  1130.    <sys/tty.h>.  Place the following #define between these two #includes:
  1131.  
  1132.     #define _IO_PTEM_H
  1133.  
  1134. This works around the problem with the system header files, if you're
  1135. not excited about modifying them (or don't have su privileges).
  1136.  
  1137.  
  1138. Subject: D33) How do I compile emacs?
  1139.  
  1140. The UnixWare cc preprocessor (cc -P) doesn't work the same as
  1141. /usr/ccs/bin/cpp from the configure script.  You have three options:
  1142.  
  1143. 1) Use gcc.  The GNU compiler groks the GNU configure file.
  1144.  
  1145. 2) Use the UnixWare preprocessor /usr/ccs/bin/cpp directly.
  1146.  
  1147. 3) Get the emacs binary as indicated in the FAQ.
  1148.  
  1149. Subject: D34) How do I compile Perl 5?
  1150.  
  1151. Note that Perl 5 source and binaries are now available from ftp.freebird.org
  1152.  
  1153. tye@fohnix.metronet.com (Tye McQueen) wrote:
  1154.  
  1155.    Porting (aka Installing) Perl 5.x to UnixWare systems can be
  1156.    confusing, but it need not be difficult.  Here are some notes
  1157.    to help you.  I hope to make some of these notes obsolete in a
  1158.    future release of Perl and to include the remaining ones in a
  1159.    README.svr4 file in that distribution.
  1160.  
  1161.    First, be sure you have Perl5.001m or later.  You can fetch a copy
  1162.    from:
  1163.      ftp://ftp.metronet.com/pub/perl/source/perl5.001m.tar.gz
  1164.     or many other places listed in the Perl meta-FAQ, which can be
  1165.     found at:
  1166.      http://www.khoros.unm.edu/staff/neilb/perl/metaFAQ/metaFAQ.html
  1167.     or
  1168.      ftp://ftp.khoros.unm.edu/pub/perl/metaFAQ.txt
  1169.    I don't recommend trying to apply patches to a Perl5.000 or
  1170.    Perl5.001 distribution; just fetch the full latest distribution.
  1171.  
  1172.    Next, an easy way to build Perl successfully is simply:
  1173.  
  1174.     1.  $ mv -f config.sh config.sh.old
  1175.     2.  $ ./Configure -dsE
  1176.     3. You can edit config.sh here (but don't do it this first time).
  1177.     4.  $ ./Configure -S
  1178.     5.  $ env LD_LIBRARY_PATH=`pwd` make
  1179.     6.  $ env LD_LIBRARY_PATH=`pwd` make test
  1180.     7. Become "root", if you aren't already.
  1181.     8.  # env LD_LIBRARY_PATH=`pwd` make install
  1182.     9. Answer "yes" that you want /usr/bin/perl set up.
  1183.  
  1184.    I say "simply" because this method only asks you one question and I've
  1185.    told you what the answer is.  Yes, it is more steps than it should be.
  1186.  
  1187.    You might want to save the last two steps until you are sure you
  1188.    have everything configured the way you like.  Please don't let the
  1189.    "WHOA THERE!!!"s scare you.  They are there for a reason and the
  1190.    default answer ("yes") is what you want.
  1191.  
  1192. More advanced options
  1193.  
  1194.    If you don't like the directories that Configure picks to install
  1195.    things into, the simplest change is to add "-Dprefix=/usr/local" on
  1196.    the end of Step 2 above (where "/usr/local" is the directory where
  1197.    you want "bin/*", "lib/perl5/...", and possibly "man/*/*" to be
  1198.    installed).  ./Configure will pick /usr/local if it exists,
  1199.    otherwise it will probably pick /opt.
  1200.  
  1201.    You can also go back to Step 3 above and change the paths in config.sh
  1202.    that you don't like (the Notes section has more hints on doing this).
  1203.  
  1204.    There are even more options you can give to Configure to influence
  1205.    what directories it picks, but I haven't tested those options so I
  1206.    won't go into those switches here.  You can type "./Configure -h" for
  1207.    more information on switches that can be given to Configure.
  1208.  
  1209.    If you want to use GNU CC to build Perl:
  1210.  
  1211.      * Add "-Dcc=gcc" on the end of Step 2 above.
  1212.      * Be sure to not use GNU AS, GNU LD, nor GNU LIBC.
  1213.      * Make sure you installed GNU CC correctly, including the
  1214.        "fix-includes" step.
  1215.      * You may be able to use GNU's gdbm to emulate odbm and ndbm for the
  1216.        ODBM_File and NDBM_File extensions, but I've seen reports of
  1217.        problems (lock ups) with this under Linux.
  1218.  
  1219.    I haven't installed gcc so I haven't tested this (these hints come
  1220.    from problems others have had using GCC on other systems).
  1221.  
  1222. Possible problems
  1223.  
  1224.   Building Perl on UnixWare 1.x then running on UnixWare 2.x
  1225.  
  1226.    The most serious problem I am aware of is that a Perl executable
  1227.    compiled on UnixWare 1.x may run on UnixWare 2.x but it will not
  1228.    do I/O correctly.  This is because Perl uses some "officially
  1229.    non-standard" optimizations (that happen to port well to a wide
  1230.    variety of UNIX systems) in order to get much faster I/O under many
  1231.    circumstances.
  1232.  
  1233.    If you really want one version of Perl that will run on both UnixWare
  1234.    1.x and UnixWare 2.x, then you can disable these optimizations either
  1235.    by adding "-Dd_stdiobase=undef" on the end of Step 2 above or by
  1236.    going back to Step 3 above and changing d_stdiobase='define' to
  1237.    d_stdiobase='undef' then continuing on with the rest of the steps.  I
  1238.    have tested both of these methods and am using such a version of Perl
  1239.    under both UnixWare 1.1 and UnixWare 2.01.
  1240.  
  1241.    If I don't find any problems with it I will update the hints/svr4.sh
  1242.    file to do this automatically for UnixWare systems.  I'll also see if
  1243.    Novell or SCO will make this version available in "pkgadd" format.
  1244.  
  1245.   File glob tests fail due to broken csh in UnixWare 1.1.4.
  1246.  
  1247.    I have two reports that the version of csh included with UnixWare 1.1.4
  1248.    is broken (which is the version of csh included in PTF2001 which fixes
  1249.    memory leaks in csh).  This will cause some of the "file glob" tests to
  1250.    fail.
  1251.  
  1252.    If this happens to you, you can get around the problem by going back
  1253.    to Step 3 above and changing d_csh='define' to d_csh='undef' in
  1254.    config.sh then continuing on with the remaining steps.  You might also
  1255.    want to check out my File::Glob module which does file globbing inside
  1256.    Perl (http://www.metronet.com/~tye/glob.html).
  1257.  
  1258.   Easy to break DynaLoader, ODBM_File, and NDBM_File.
  1259.  
  1260.    You should be able to include Dynamic Loading along with both the
  1261.    ODBM_File and NDBM_File extensions in Perl under SVR4.  It is very easy
  1262.    to run into problems using any of these three features under SVR4, but
  1263.    if you follow the above instructions, then you shouldn't run into
  1264.    these problems.
  1265.  
  1266.    You won't get the ODBM_File nor NDBM_File extensions if you haven't
  1267.    installed the "BSD Compatibility" package.  This is because the dbm
  1268.    routines are kept in /usr/ucblib/libucb.a and the ndbm routines are
  1269.    kept in /usr/ucblib/libdbm.a and require /usr/ucblib/libucb.a.
  1270.  
  1271.    This stuff is easy to break because all SVR4 systems (except UnixWare
  1272.    2.x -- thanks Novell!) have a broken /usr/ucblib/libucb.a which will
  1273.    often break programs that try to use it.  The hints/svr4.sh file can
  1274.    usually prevent problems by telling Perl to not use most of the
  1275.    routines in libucb.a.  The way hints/svr4.sh does this is why Configure
  1276.    gives you all of those scary "WHOA THERE!!!" warnings.
  1277.  
  1278.    You can use most (on UnixWare 2.x, all) of the BSD-compatibility
  1279.    routines, if you want.  I made the defaults to not use any of these
  1280.    for several reasons.
  1281.  
  1282.      * Prior to UnixWare 2.x, trying to ld with the floating point
  1283.        routines from libucb.a (ecvt, gcvt, fcvt, etc.) resulted in
  1284.        "undefined symbol" errors.  If using them only in a dynamically
  1285.        loaded extension, then these "unresolved external" errors might
  1286.        not show up until you tried to use the extension.
  1287.      * I worried that there could be SVR4.x systems with versions of
  1288.        libucb.a where even more of these routines don't work.
  1289.      * I don't believe that they add any functionality over the
  1290.        corresponding native SVR4.x routines, even considering how Perl
  1291.        knows how to use them.  If anyone finds otherwise, please let us or
  1292.        me know so that Perl can be fixed to use the SVR4.x routines more
  1293.        effectively.
  1294.      * I worry that they add some overhead, though probably not a great
  1295.        amount.
  1296.  
  1297. Notes
  1298.  
  1299.   Changing where Perl will be installed
  1300.  
  1301.    Don't worry too much about all the stuff in config.sh that may not
  1302.    make sense to you.  You can just change the first part of any absolute
  1303.    paths (those that start with "/") that appear between single quotes
  1304.    (') after an equal sign (=).  But don't change any of these "paths"
  1305.    that point to files that already exist on your system (ie. only change
  1306.    ones that point either to directories or to places that don't exist
  1307.    yet).  Save a copy of config.sh before you edit it in case you change
  1308.    your mind.
  1309.  
  1310. Hint: When running the tests, set your locale to the C locale,
  1311.         LANG=C
  1312.         export LANG
  1313.  
  1314. Subject D35) Where can I get audio software for UnixWare ?
  1315.  
  1316. Voxware driver support for UnixWare 1.x and 2.x can
  1317. be found on ftp.freebird.org:/unixware/freebird/sound.
  1318.  
  1319.  
  1320. Subject D36) Where can I get the GNU debugger (gdb) for UnixWare 2?
  1321.  
  1322. This can be found in the developer section of the freebird
  1323. archive. Check ftp://ftp.freebird.org/unixware/developer.
  1324.  
  1325.  
  1326. Subject: D37) How can I debug an application without the source code?
  1327.  
  1328. Peter Lord writes:
  1329.  
  1330. If you are a developer working on a new software product, then debugging
  1331. an application is fairly straight forward. But what can you do if you
  1332. are an end user and don't have access to the source code?
  1333.  
  1334. You may come across this problem when trying to run an application
  1335. designed for a different operating system on UnixWare.
  1336.  
  1337. Truss
  1338.  
  1339. Truss(1) is a wonderful program designed for debugging BINARY programs.
  1340. It takes control of the process you are interested and prints out all
  1341. the system calls your program makes!
  1342.  
  1343. For example, if you tried to run the SCO version of Framemaker 3.1X on
  1344. UnixWare, you will find it fails without any sensible error message. By
  1345. trussing the Framemaker binaries, you can find out if any of the system
  1346. calls are failing. In this example, it was easy to find out that
  1347. Framemaker was trying to run a program from the bin.i386 directory ...
  1348. but only a bin.scounix directory existed. A simple symbolic link brought
  1349. the application into life!
  1350.  
  1351. Lets take a simple example. 
  1352.  
  1353. $ ls /fred
  1354. UX:ls: ERROR: Cannot access /fred: No such file or directory
  1355. $
  1356.  
  1357. In this case we get a error message which can be understood ... but this
  1358. may not always be the case. Now, if we truss this same command we get :-
  1359.  
  1360. $ truss -o/tmp/trussout ls /fred
  1361. UX:ls: ERROR: Cannot access /fred: No such file or directory
  1362. $
  1363.  
  1364. and the file /tmp/trussout contains :- 
  1365.  
  1366. ...
  1367. lxstat(2, "/fred", 0x08047520)                  Err#2  ENOENT
  1368. ...
  1369. write(2, " U X : l s :  ", 7)                   = 7
  1370. write(2, " E R R O R", 5)                       = 5
  1371. write(2, " :  ", 2)                             = 2
  1372. write(2, " C a n n o t   a c c e s".., 47)      = 47
  1373. _exit(2)
  1374.  
  1375. Here you can see that ls has made a system call lxstat which returns an
  1376. error.
  1377.  
  1378. So you can see that although truss cannot follow all of the program, it
  1379. can print out the system calls and so give you some clues to where your
  1380. program is failing.
  1381.  
  1382. One useful truss option is -t. This allows tracing of certain system
  1383. calls only (and thus reducing the amount of output you need to scan
  1384. through). See the truss manual page for more options.
  1385.  
  1386. Truss can even follow processes which are currently running! For
  1387. example, if you want to debug your running lockd daemon, use ps to find
  1388. out it's process id and then use the command truss -p pid. 
  1389.  
  1390. Subject: D38)When I link I can 't find the syslog routines, what should I do?
  1391.  
  1392. You need to include libgen. Add -lgen to your link line.
  1393.  
  1394. Subject: D39) When I link I can 't find the strcasecmp routine?
  1395.  
  1396. You need to link to the ucblib library. This has to be done
  1397. as follows:
  1398.         -lc -L/usr/ucblib -lucb
  1399.  
  1400. Alternately just extract the object file (stricmp.o) from
  1401. /usr/ucblib/libucb.a and link that to your executable:
  1402.  
  1403. $ cd /tmp
  1404. $ ar x /usr/ucblib/libucb.a stricmp.o  
  1405.  
  1406. Subject: D40) When I link I can 't find the alloca routine?
  1407.  
  1408. See D38 above.
  1409.  
  1410. Subject: D41) How do I make a pkgmk add-on package?
  1411.  
  1412. UnixWare supports the SVR4 packaging tools and the pgmk(1) utility
  1413. to create a package.  If you cannot find the packaging tool that you need , 
  1414. check that you have the  Software Packaging Tools (softint) package
  1415. installed from the SDK (or ask SCO to make a PTF - since they
  1416. tools really ought to be available to all developers)
  1417.  
  1418. These three tools are in the Base 
  1419.  
  1420. /usr/bin/pkginfo - display software package information
  1421. /usr/bin/pkgparam - display package parameter values
  1422. /usr/bin/pkgtrans - translate package format
  1423.  
  1424. The key scripts for creating packages are in the SDK softint package:
  1425.  
  1426. /usr/bin/pkgmk - create a package
  1427. /usr/bin/pkgproto - generate a package prototype file
  1428.  
  1429. For further details refer to the  Software Tools Book in Dynatext, Chapter 8,
  1430. or the UNIX SVR4 Programmer's Guide: System Services
  1431. and Application Packaging Tools Manual. The Generic Application Binary
  1432. Interface (gABI) specification is also a good reference for this material.
  1433.  
  1434. This will allow the system to track all installed software thus
  1435. ensuring its integrity.
  1436.  
  1437. Its good practice for applications to only install or create files in 
  1438. designated places within the file tree away from the system
  1439. files if possible. A possible scenario is noted below. 
  1440.  
  1441.                         root or "/"
  1442.                         /    |    \   \
  1443.                        /     |     \   \
  1444.                      opt    usr    etc  var
  1445.                    / | \     |      |   /  \
  1446.                  bin man lib bin   opt opt  tmp
  1447.                         / \         / \
  1448.                       pkg1 pkgn   pkg1 pkgn
  1449.  
  1450. /opt, /var/opt and /etc/opt\f1 are reserved in the file
  1451. tree for the installation of application software packages. Each
  1452. add-on package should adhere to the following rules.
  1453. Static package objects should be installed in /opt/lib/pkg, where
  1454. pkg is the package abbreviation.
  1455.  
  1456. Package objects that change in normal operations (for example,
  1457. log and spool files) should be installed in /var/opt/pkg
  1458.  
  1459. Machine-specific configuration files should be installed in 
  1460. /etc/opt/pkg.
  1461.  
  1462. Executables that are directly invoked by users should be installed
  1463. in /opt/bin
  1464.  
  1465. Only package objects that must reside in specific locations within the
  1466. system file tree in order to function properly (for example,
  1467. special files in /dev) should be installed in those locations.
  1468.  
  1469. An advantage of putting all package files under /opt is that allows
  1470. that directory to be networked.
  1471.  
  1472. A very simple example - The mush Package
  1473. -----------------------------------------
  1474. To create an SVR4 package the following files should be created
  1475.  
  1476. copyright pkginfo prototype postinstall
  1477.  
  1478. copyright
  1479. ---------
  1480. This contains the copyright notice for the package. For example:
  1481.  
  1482.  
  1483. Mush is copyright (c) 1986, 1987, 1988, 1989, 1990, 1991 by Dan Heller.
  1484. All Rights Reserved.   This software is not in the public domain.
  1485.  
  1486. Redistribution of the unmodified source code is permitted as long as all
  1487. copyright notices remain intact and all other identifying notices remain
  1488. in the code and in the binary.  This includes message headers on outgoing
  1489. mail and the startup message.  Future releases may extract the release
  1490. version from the message headers of mush-originated messages to aid in
  1491. implementing features and providing backwards compatibility with previous
  1492. versions.  Modification of the source for personal use is permitted.
  1493. Modifications sent to the authors are humbly accepted and it is their
  1494. prerogative to make the mods official.  Only the "official" sources may be
  1495. redistributed and no sale of the code or any part thereof is permitted
  1496. without written consent from the authors.  Further, no part of the code
  1497. may be used in any other product, free or otherwise, without consent from
  1498. the authors.  Distribution of sources containing adaptations of the SunView
  1499. interface to XView or to any X11-based interface is expressly prohibited.
  1500.  
  1501. MUSH IS PROVIDED AS IS, WITHOUT WARRANTY.  AUTHORS HEREBY DISCLAIM
  1502. ALL WARRANTIES INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES
  1503. OF FITNESS FOR A PARTICULAR PURPOSE.
  1504.  
  1505. pkginfo
  1506. -------
  1507.  
  1508. pkginfo is an ASCII file that describes the characteristics
  1509. of the package along with information that helps control the
  1510. flow of installation.  It is created by the software package
  1511. developer.
  1512.  
  1513. Each entry in the pkginfo file is a line that establishes
  1514. the value of a parameter in the following form:
  1515.  
  1516. PARAM="value"
  1517.  
  1518. An example follows:
  1519.  
  1520. $ cat pkginfo
  1521. PKG="mush"
  1522. VERSION="7.2.5"
  1523. NAME="Mail Users Shell"
  1524. CATEGORY="application"
  1525. CLASSES="none"
  1526. PREDEPEND=mush
  1527. VENDOR="(c) 1989 Dan Heller"
  1528.  
  1529.  
  1530. For more information see pkginfo(4).
  1531.  
  1532. prototype - package information file
  1533. --------------------------------------
  1534.  
  1535. prototype is an ASCII file used to specify package
  1536. information.  Each entry in the file describes a single
  1537. deliverable object.  An object may be a data file,
  1538. directory, source file, executable object, etc.  This file
  1539. is generated by the package developer (most often using the
  1540. pkgproto command).
  1541.  
  1542. Entries in a prototype file consist of several fields of
  1543. information separated by white space.  Comment lines begin
  1544. with a ``#'' and are ignored.
  1545.  
  1546. An example follows:
  1547.  
  1548.  
  1549. $ cat prototype
  1550. i pkginfo
  1551. i copyright
  1552. i postinstall
  1553. d none /opt ? ? ?
  1554. d none /opt/bin ? ? ?
  1555. d none /etc ? ? ?
  1556. d none /etc/mail ? ? ?
  1557. f none /opt/bin/mush 0755 bin bin
  1558. d none /opt/lib/mush 0755 bin bin
  1559. d none /opt/man 0755 bin bin
  1560. d none /opt/man/man1 0755 bin bin
  1561. f none /opt/man/man1/mush.1 0644 bin bin
  1562. f none /opt/lib/mush/Mushrc 0644 bin bin
  1563. f none /opt/lib/mush/cmd_help 0644 bin bin
  1564. f none /opt/lib/mush/Mailrc 0644 bin bin
  1565. f none /opt/lib/mush/Gnurc 0644 bin bin
  1566. f none /opt/lib/mush/advanced.mushrc 0644 bin bin
  1567. f none /opt/lib/mush/sample.mushrc 0644 bin bin
  1568.  
  1569.  
  1570. For more information see prototype(4).
  1571.  
  1572. postinstall - postinstallation commands
  1573. -------------------------------------------
  1574.  
  1575. This script is run with root privilege after the installation (note
  1576. that a preinstall file can be created to run commands before the
  1577. installation). (Note that this script asks for input and 
  1578. strictly speaking that should be done thru a request script).
  1579.  
  1580. An example follows:
  1581.  
  1582. $ cat postinstall
  1583.  
  1584. echo "\n\t NOTE: To setup your From: address line edit /etc/mail/mush/Mushrc"
  1585. echo "\tAttempting to set this up. If not setup the From: line will default"
  1586. echo "\tto the system name. Its best to use a domain address i.e. site.domain"
  1587. echo "\talthough you must be registered."
  1588. echo "\tEnter your domain address --->\c"
  1589. read address
  1590. if [ "${address}" = "" ]
  1591. then
  1592.     echo "\tYou did not enter an address so /etc/mail/mush/Mushrc not setup."
  1593. else
  1594.     echo "\tYou entered \"$address\" as your domain name"
  1595.     echo "\tThis will now be entered in the /etc/mail/mush/Mushrc file."
  1596.     echo "\tIf you made a mistake edit the file by hand."
  1597. fi
  1598. sleep 2
  1599. echo "set hostname=\"$address\"" >>/etc/mail/mush/Mushrc
  1600.  
  1601.  
  1602. pkgmk - produce an installable package
  1603. ---------------------------------------
  1604.  
  1605. To build the package use pkgmk. 
  1606.  
  1607. NOTE: pkgmk requires root privilege.
  1608.  
  1609. For example to create the package in /var/spool/pkg.
  1610.  
  1611. Ensure you are the same directory as the packaging commands,
  1612. and that the target package files are installed  in the correct
  1613. locations (this simplifies things a lot).
  1614.  
  1615. # pkgmk -ai386 -r /
  1616.  
  1617. If you want to overwrite an existing package in the /var/spool/pkg
  1618. directory use the "-o" flag to pkgmk; pkgmk -ai386 -o -r /.
  1619.  
  1620. If you don't want to install the utility in its final 
  1621. destination prior to package creation, then a tree of files
  1622. can be created in a subdirectory call root, and the prototype
  1623. file edited as follows:
  1624.  
  1625. $ cat prototype
  1626. i pkginfo
  1627. i copyright
  1628. i postinstall
  1629. d none /opt ? ? ?
  1630. d none /opt/bin ? ? ?
  1631. d none /etc ? ? ?
  1632. d none /etc/mail ? ? ?
  1633. f none /opt/bin/mush=root/opt/bin 0755 bin bin
  1634. d none /opt/lib/mush=root/opt/lib 0755 bin bin
  1635. d none /opt/man=root/opt/man 0755 bin bin
  1636. d none /opt/man/man1=root/opt/man/man1 0755 bin bin
  1637. f none /opt/man/man1/mush.1=root/opt/man/man1/mush.1 0644 bin bin
  1638. f none /opt/lib/mush/Mushrc=root/opt/lib/mush/Mushrc 0644 bin bin
  1639. f none /opt/lib/mush/cmd_help=root/opt/lib/mush/cmd_help 0644 bin bin
  1640. f none /opt/lib/mush/Mailrc=root/opt/lib/mush/Mailrc 0644 bin bin
  1641. f none /opt/lib/mush/Gnurc=root/opt/lib/mush/Gnurc 0644 bin bin
  1642. f none /opt/lib/mush/advanced.mushrc=root/opt/lib/mush/advanced.mushrc \
  1643.   0644 bin bin
  1644. f none /opt/lib/mush/sample.mushrc=root/opt/lib/mush/sample.mushrc  \
  1645.    0644 bin bin
  1646.  
  1647. Package creation is the simply:
  1648.  
  1649.         pkgmk -ai386 -o
  1650.  
  1651. (no -r / this time)
  1652.  
  1653. Creating a floppy copy
  1654. ----------------------
  1655.  
  1656. To create a floppy copy:
  1657.  
  1658. # pkgtrans spool diskette1 mush
  1659.  
  1660. Another Example - Sendmail 
  1661. ============================
  1662. This example uses the menu routines to generate a blue screen menu
  1663. upon installation.
  1664.  
  1665. The packaging tree is listed below:
  1666.  
  1667. $ find . -print
  1668. .
  1669. ./install
  1670. ./install/copyright
  1671. ./install/i.save
  1672. ./install/menu.1
  1673. ./install/menu.err
  1674. ./install/menu.intro
  1675. ./install/postinstall
  1676. ./install/postremove
  1677. ./install/preinstall
  1678. ./install/r.save
  1679. ./install/request
  1680. ./pkginfo
  1681. ./prototype
  1682. ./root
  1683. ./root/etc
  1684. ./root/etc/mail
  1685. ./root/etc/mail/mailsurr
  1686. ./root/usr
  1687. ./root/usr/ucblib
  1688. ./root/usr/ucblib/sendmail
  1689. ./root/usr/ucblib/sendmail.cf
  1690. $                          
  1691.  
  1692. The contents of some of the key files above are listed below:
  1693.  
  1694. copyright
  1695. ---------
  1696.  
  1697. copyright - the copyright notice
  1698.  
  1699. i.save
  1700. ------
  1701.  
  1702. i.save - a script run by the system to backup files
  1703.  
  1704. #!/bin/sh
  1705. # i.save script
  1706. # script which backs up files
  1707. #
  1708. while read src dst ; do
  1709.  
  1710.         [ "$src" = /dev/null ] && continue
  1711.  
  1712.         if [ -f $dst ] ; then
  1713.                 echo $dst | cpio -pdmu $PKGSAV >/dev/null 2>&1
  1714.         fi
  1715.         cp $src $dst.tmp || exit 1
  1716.         mv $dst.tmp $dst || exit 1
  1717. done
  1718. exit 0    
  1719. # end of i.save script
  1720.  
  1721.  
  1722. menu.1
  1723. --------
  1724.  
  1725. menu.1 - part of the blue screen menu
  1726.  
  1727.  
  1728. .pageno
  1729. Page %d of %d
  1730. .ul
  1731. Sendmail Installation
  1732. .helpbanner
  1733. Help on Sendmail Installation
  1734. .hhelp_ban
  1735. Help on menus
  1736. .ur
  1737. Introduction
  1738. .ll
  1739. Please make a selection.
  1740. .lr
  1741. Del=Cancel  F1=Help
  1742. .top
  1743.  
  1744. This is a binary distribution of Sendmail 8.7.3 for UnixWare 2.x.
  1745. This package sets up your system to use Sendmail instead of the
  1746. default mailsurr based mailer.
  1747.  
  1748. AS SUCH, THIS IS AN UNSUPPORTED PACKAGE, TO BE USED AT YOUR OWN RISK.
  1749.            
  1750. This package saves all files it changes so they can be restored
  1751. on its removal.  You must restart TCP/IP after installing this package
  1752.  
  1753. sh /etc/inet/rc.restart
  1754.  
  1755. This port by :
  1756.  
  1757. Joe Doupnik, jrd@cc.usu.edu, Utah State University, 31 Dec 1995.
  1758.  
  1759. .bottom
  1760. press 'ENTER' (or 'RETURN') to install.
  1761. .help
  1762. The following assumptions are made about the installation:
  1763.  
  1764. o The directories used by this pacakage are
  1765.         /usr/ucblib             - for the mail executable
  1766.         /etc/mail               - for the mail configuration
  1767.  
  1768. .helpinst
  1769. Esc=Quit Help  Del=Cancel  F1=Instructions
  1770. .hhelpinst
  1771. Esc=Quit Instructions  Del=Cancel 
  1772.  
  1773.  
  1774. menu.err
  1775. ----------
  1776. menu.err - another part of the blue menu screens
  1777.  
  1778.  
  1779. .pageno
  1780. Page %d of %d
  1781. .ul
  1782. Sendmail Installation
  1783. .helpbanner
  1784. Help on Sendmail Installation
  1785. .hhelp_ban
  1786. Help on menus
  1787. .ur
  1788. Error
  1789. .ll
  1790. Press return when ready
  1791. .lr
  1792. Del=Cancel  F1=Help
  1793. .top
  1794.  
  1795.  
  1796.  
  1797.  
  1798.  
  1799.  
  1800.  
  1801.  
  1802. `echo $ERROR`
  1803. .bottom
  1804. Press 'ENTER' (or 'RETURN') to continue.
  1805. .help
  1806. .helpinst
  1807. Esc=Quit Help  Del=Cancel  F1=Instructions
  1808. .hhelpinst
  1809. Esc=Quit Instructions  Del=Cancel 
  1810.  
  1811.  
  1812. menu.intro
  1813. -----------
  1814. menu.intro - more of the blue menu
  1815.  
  1816.  
  1817. .pageno
  1818. Page %d of %d
  1819. .ul
  1820. Sendmail Installation
  1821. .helpbanner
  1822. Sendmail Copyright Notice
  1823. .hhelp_ban
  1824. Help on menus
  1825. .ur
  1826. Introduction
  1827. .lr
  1828. Del=Cancel  F1=View Copyright
  1829. .ll
  1830. Press RETURN when ready
  1831. .top
  1832. Welcome to the Sendmail installation.
  1833.  
  1834. This installs sendmail as the default mailer.
  1835. This package is copyrighted. To re-view the copyright notice press F1 or '?'.
  1836.  
  1837.  
  1838. .bottom    
  1839. Press 'ENTER' (or 'RETURN') to continue.
  1840. .help
  1841. The full notice may be found in /var/sadm/pkg/sendmail/install/copyright
  1842.  
  1843. Copyright (c) 1983, 1995 Eric P. Allman
  1844. Copyright (c) 1988, 1993
  1845.       The Regents of the University of California.  All rights reserved.
  1846.  
  1847.  
  1848. .helpinst
  1849. Esc=Quit Copyright  Del=Cancel  F1=Instructions
  1850. .hhelpinst
  1851. Esc=Quit Instructions  Del=Cancel
  1852.  
  1853.  
  1854. postinstall
  1855. -----------
  1856.  
  1857. postinstall - the script executed after the software is installed
  1858.  
  1859. #!/bin/sh
  1860. # postinstall script
  1861.  
  1862.  
  1863. if [ -f /etc/inet/config ] ; then
  1864.    if grep sendmail: /etc/inet/config >/dev/null ; then
  1865.       :
  1866.    else
  1867.  
  1868.       # Save old version with the packaging
  1869.       echo /etc/inet/config | cpio -pdmu $PKGSAV 2>/dev/null
  1870.       echo '8:/usr/ucblib/sendmail::y:/usr/ucblib/sendmail.cf:-bd -q2h :' \
  1871.        >> /etc/inet/config
  1872.    fi
  1873. fi
  1874.  
  1875. echo /etc/init.d/smtpinit |cpio -pdmu $PKGSAV 2>/dev/null
  1876.  
  1877. TMP=/tmp/pkg$$
  1878. echo "#!/bin/sh \nexit 0" > $TMP
  1879. cat /etc/init.d/smtpinit  >>$TMP
  1880. cp $TMP /etc/init.d/smtpinit
  1881.                  
  1882. exit 0  
  1883. # end of postinstall script
  1884.  
  1885. postremove
  1886. -----------
  1887.  
  1888. postremove - script executed to removing the software
  1889.  
  1890. #!/bin/sh
  1891. # postremove used to restore original files
  1892.  
  1893. cd $PKGSAV
  1894. echo "Warning the following files have been restored, any changes"
  1895. echo "made to them since installing this package will be lost."
  1896. find . -type f -print|cpio -pdmuv /
  1897. exit 0 
  1898. # end of postremove
  1899.  
  1900.  
  1901. preinstall
  1902. ----------
  1903.  
  1904. preinstall - executed before installing files
  1905.  
  1906. #!/bin/sh
  1907. # preinstall - some dependency checks
  1908.  
  1909. rel=`uname -v |cut -f1 -d"."`
  1910. if [ "$rel" -ne "2" ]
  1911. then
  1912.         echo "This package requires UnixWare version 2.x to install."
  1913.         exit 1
  1914. fi
  1915. sh /etc/rc2.d/S81smtp stop
  1916.  
  1917. exit 0  
  1918. # end of preinstall
  1919.  
  1920. r.save
  1921. -------
  1922.  
  1923. r.save - class script to restore files
  1924.  
  1925.  
  1926. #!/bin/sh
  1927. #
  1928. # script which backs up files
  1929. #
  1930.  
  1931. cd $PKGSAV
  1932.  
  1933. while read file ; do
  1934.         if [ -f ./$file ]
  1935.         then
  1936.                 mv ./$file $file.tmp || continue
  1937.                 mv $file.tmp $file
  1938.         else
  1939.                 rm -f $file
  1940.         fi
  1941. done
  1942. exit 0   
  1943. # end of r.save script
  1944.  
  1945. request
  1946. -------
  1947.  
  1948. request - script to display the menus & handle the input
  1949.  
  1950. # geta question default
  1951. MENU=/usr/sbin/menu
  1952.  
  1953. cd $REQDIR || exit 1
  1954. rm -f /tmp/out.$$
  1955. $MENU -f menu.intro -o /tmp/out.$$
  1956. if [ ! -f /tmp/out.$$ ] ; then
  1957.          exit 1
  1958. else
  1959.         . /tmp/out.$$
  1960. fi
  1961.  
  1962. rm -f /tmp/out.$$
  1963. $MENU -f menu.1 -o /tmp/out.$$
  1964. if [ ! -f /tmp/out.$$ ] ; then
  1965.          exit 1
  1966. else
  1967.         . /tmp/out.$$
  1968. fi
  1969.  
  1970. echo "NPATH=$NPATH" >> $1  
  1971.  
  1972.  
  1973.  
  1974. pkginfo
  1975. -------
  1976. The pkginfo script has the save class defined so
  1977. that files can be backed up and restored using the 
  1978. i.save and r.save scripts
  1979.  
  1980. ARCH=i386
  1981. PKG=sendmail
  1982. VERSION=8.7.3
  1983. NAME=Sendmail Mailer
  1984. CATEGORY=system
  1985. DEPEND=sendmail
  1986. CLASSES=none save
  1987.  
  1988.  
  1989.  
  1990. prototype
  1991. --------
  1992. The prototype shows the save class being used for the
  1993. mailsurr, and old sendmail files.
  1994.  
  1995. i pkginfo
  1996. i preinstall=install/preinstall
  1997. i copyright=install/copyright
  1998. i menu.intro=install/menu.intro
  1999. i menu.1=install/menu.1
  2000. i menu.err=install/menu.err
  2001. i postinstall=install/postinstall
  2002. i postremove=install/postremove
  2003. i request=install/request
  2004. i i.save=install/i.save
  2005. i r.save=install/r.save
  2006. d none / ? ? ?
  2007. d none /usr ? ? ?
  2008. d none /etc ? ? ?
  2009. d none /etc/mail ? ? ?
  2010. d none /etc/ucbmail ? ? ?
  2011. d none /usr/ucblib ? ? ?
  2012. f save /etc/mail/mailsurr=root/etc/mail/mailsurr 444 root mail
  2013. f save /usr/ucblib/sendmail=root/usr/ucblib/sendmail 04111 root mail
  2014. f save /etc/ucbmail/sendmail.cf=root/usr/ucblib/sendmail.cf 444 bin bin
  2015.  
  2016.  
  2017. Creating the package
  2018. --------------------
  2019. In this case
  2020.         pkgmk -ai386 -o 
  2021.  
  2022. Subject: D42) How to build binaries on UnixWare to run on other SVR4 systems 
  2023.    such as Solaris x86?
  2024.  
  2025. Scott Raney <raney@metacard.com> writes:
  2026.  
  2027. 1) Always link libraries dynamically. 
  2028.  
  2029. 2) We had to put the following hack in to make UnixWare 2.0 binaries
  2030. run on Solaris 2.4:
  2031. #ifdef UNIXWARE
  2032. extern "C" {
  2033. int sys_nerr;
  2034. int     *__thr_errno()
  2035. {
  2036.   return &errno;
  2037. }
  2038. }
  2039. #endif
  2040.  
  2041. 3) Be sure to thoroughly test all code that runs subrocesses,
  2042. especially code that reads and writes to pipes to the child processes.
  2043. The gotchas here are too obscure to detail here, but they'll get you
  2044. if you don't hunt them down.      
  2045.  
  2046.  
  2047. John Moyer (jrm@questconsult.com) writes :
  2048.  
  2049. To build binaries that run under Dell Unix from Unixware 2.0x, static
  2050. linking is best. Static linking is not possible with Athena Widgets or
  2051. wide character support or anything else that requires -lnsl.
  2052.  
  2053. To build X11R6 binaries from UnixWare 2.0x to run under Unixware 1.1.4
  2054. I found it necessary to link with libc.so and libnsl.so from unixware
  2055. 1.1.4. This is not necessary if libXaw.so is built with the x.org 
  2056. wide character support instead of using -lw.
  2057.  
  2058. Binaries with "long double" variables do not seem to run under the
  2059. Linux iBCS emulation. Static linking seems to me to be best for Linux
  2060. iBCS.
  2061.  
  2062. Subject: D43)How do I display files open to UnixWare processes? 
  2063.  
  2064. Vic Abell  writes:
  2065.  
  2066. A.  Lsof (for list open files) will list the files open to UnixWare
  2067.     2.x processes, including local and remote Internet addresses
  2068.     for socket files with open connections.  Lsof provides a wide
  2069.     range of filters for selecting the processes to be displayed.
  2070.     It has an output mode that is designed for easy post-filtering
  2071.     of output with AWK, PERL, or shell scripts.
  2072.  
  2073.     Lsof may be found at:
  2074.  
  2075.         ftp://vic.cc.purdue.edu/pub/tools/unix/lsof
  2076.  
  2077.     A UnixWare 2.x binary may be found at:
  2078.  
  2079.         ftp://vic.cc.purdue.edu/pub/tools/unix/lsof/binaries/unixware
  2080.  
  2081.     but the author (Vic Abell ) recommends you
  2082.     build your own binary.        
  2083.  
  2084.  
  2085. Acknowledgements   
  2086. ---------------
  2087.  
  2088. Special thanks to Darren R. Davis and the Novell UnixWare
  2089. Developer Support team for getting this FAQ going and to
  2090. those folks who've made suggestions and contributions either
  2091. directly or via the netnews.
  2092.  
  2093.  
  2094. ----
  2095. Andrew Josey.
  2096. Disclaimer: Any views expressed are not those of my employer, either past, 
  2097. present or future.
  2098.  
  2099.