Cdlib example program: Description: Cdlib scans the database file of the "workman" program. Workman is a program which plays and displays information about audio CDs using a SCSI CD ROM drive connected to your Solaris workstation. The program allows you to enter CD Title, Artist and Track information on any CD that it plays. It maintains this information in a database file (~/.workmandb) which it can then recall later when you load a CD it has seen before. The Cdlib program scans through the database file and computes statistics about the CDs entered such as the total amount of music, the average length of all the CDs in the database and the longest and shortest CD. Usage: Cdlib Analyzes the CD library informantion in $HOME/.workmandb Cdlib database-file Analyzes the CD library informantion in database-file Example Scenario: Step 1: Make a copy of the program Copy the contents of the Cdlib directory to your own private working area with the following command: cp -r /opt/SUNWspro/examples/WorkShop/cdlib ~/cdlib NOTE: /opt/SUNWspro is the base directory where the product is installed. This directory maybe different in your environment. For fun, you could also use TeamWare to create your own workspace of this program. For more information on how to do that, refer to the manuals. Step 2: Open Project File for Cdlib Program Start WorkShop with the the "workshop" command. From WorkShop main window, select "Open Project..." from the "Project" menu and open the Project file, "~/cdlib/Cdlib.prd". This will pre-populate all your picklists for editing, building, debugging, or working with TeamWare on this example. Step 3: Build your own copy of Cdlib. From the WorkShop main window, go to the Build menu and select the "Cdlib in ..." target in the lower part of the menu. This launches a build of the program, bringing up the build-output window. The program should build successfully. Close the Build Output window when done. (or) Point WorkShop's Build window to the cdlib directory by selecting 'Build->New Target ...' from either the main window, or from the Build window if it's already open. A dialog pops-up. Change the value of 'Directory' to the location of cdlib and select 'Cdlib' as the new 'Target'. Click the 'Build' button on the dialog. Close the Build Output window when done. Step 4: Run the program under the debugger. From the WorkShop main window, select Debug->New Program... and fill out the resulting dialog box to tell the debugger that you want to debug the Cdlib executable. The debug window along with your editor of choice should come up. Select the Execute->Start menu item to run the program. If you get an error like: "Error opening the file /.workmandb" it means you have never used the program workman or created a workman CD database file. If so, select the "Debug->Edit Arguments for Cdlib" menu item in the debug pane. Enter the file, "sample.workmandb" in the "Arguments" field and select "Ok". Running the program again should work. Step 5: Play with it. Though the program seems to work correctly, there are some bugs in it. Use the "Checks" facilities to find access errors and potential memory leaks. Try making changes to enhance the program. Explore it with the browsing facility. Have fun. Copyright 2000 Sun Microsystems, Inc., 901 San Antonio Road, Palo Alto, CA 94303, U.S.A. All rights reserved.