home *** CD-ROM | disk | FTP | other *** search
- 18-Jun-88 14:50:08-MDT,5631;000000000000
- Return-Path: <u-lchoqu%sunset@cs.utah.edu>
- Received: from cs.utah.edu by SIMTEL20.ARPA with TCP; Sat, 18 Jun 88 14:49:59 MDT
- Received: by cs.utah.edu (5.54/utah-2.0-cs)
- id AA22734; Sat, 18 Jun 88 14:49:59 MDT
- Received: by sunset.utah.edu (5.54/utah-2.0-leaf)
- id AA24863; Sat, 18 Jun 88 14:49:56 MDT
- Date: Sat, 18 Jun 88 14:49:56 MDT
- From: u-lchoqu%sunset@cs.utah.edu (Lee Choquette)
- Message-Id: <8806182049.AA24863@sunset.utah.edu>
- To: rthum@simtel20.arpa
- Subject: install.c.shar
-
- #! /bin/sh
- #
- # This is a shell archive. Save this into a file, edit it
- # and delete all lines above this comment. Then give this
- # file to sh by executing the command "sh file". The files
- # will be extracted into the current directory owned by
- # you with default permissions.
- #
- # The files contained herein are:
- #
- # 3 install.c
- # 1 install.r
- #
- echo 'Extracting install.c'
- if test -f install.c; then echo 'shar: will not overwrite install.c'; else
- cat << '________This_Is_The_END________' > install.c
- /*
- * install.c
- *
- * Version: 1.0
- * Date: 4/4/86
- *
- * This program installs an INIT resource contained within the application's
- * resource fork into the current system file. I wrote it as an exercise, and
- * since no-one has posted sources to an installer, I thought I would.
- * The motivation for this program came out of both a need to understand the
- * the Resource Manager, and to avoid the bother of getting out ResEdit to
- * copy and paste INIT resources posted to the NET.
- *
- * The INIT resource alters the system error (viz. "bomb") so that it
- * displays the register contents and provides the user with a "finder"
- * button, allowing one to escape to the finder.
- *
- * I have generalised this program to allow anyone to simply change the
- * type and name of the resource that they want to install.
- * Simply alter the two STR# entries to change the type and name, and
- * use either ResEdit or RMover to put the resource you want in the
- * application.
- *
- * Thanks to Chris Borton for posting the INIT resource in the first place.
- *
- *
- * Jason Haines ISD: +61 2 73-4444
- * ElecEng Undergraduate STD: (02) 73-4444
- * 73 Davidson Avenue ARPA: munnari!ipso!runx.oz!baron@SEISMO
- * Concord NSW 2137 UUCP: seismo!munnari!basser!ipso!runx!baron
- * AUSTRALIA ACS: baron@runx
- *
- */
-
-
-
- #include <mem.h>
- #include <qd.h>
- #include <qdvars.h>
- #include <misc.h>
- #include <event.h>
- #include <res.h>
- #include <win.h>
- #include <te.h>
- #include <dialog.h>
- #include <menu.h>
- #include <string.h>
- #include <stdio.h>
-
- #define INSTALLITEM 1
- #define REMOVEITEM 2
-
- dialogptr mydialogptr;
- handle myhandle;
- int myresult, myresfile;
- char mystr[256], thename[256];
- restype thetype, mytype;
- int theid;
-
- install()
- {
- int uid, err;
-
- if ((myhandle = getnamedresource(mytype,mystr)) == NULL)
- sysbeep(200);
- hlock(myhandle);
- getresinfo(myhandle,&theid,&thetype,&thename);
- useresfile(0);
- /* do
- {
- }
- while ((uid = uniqueid(mytype)) > 127 ); */
- /* I removed the uniqueid call part because the INIT resource fails
- with any other ID */
- detachresource(myhandle);
- addresource(myhandle,mytype,theid,mystr);
- updateresfile(0);
- useresfile(myresfile);
- }
-
- remove()
- {
- useresfile(0);
- if ((myhandle = getnamedresource(mytype,mystr)) == NULL)
- sysbeep(200);
- hlock(myhandle);
- rmveresource(myhandle);
- updateresfile(0);
- useresfile(myresfile);
- }
-
- main()
- {
- maxapplzone(); /* allow maximum heap expansion */
- flushevents (everyevent,0); /* ignore left over events */
- initgraf (&theport); /* initialize the screen */
- initfonts();
- initwindows();
- initmenus();
- initcursor(); /* make the arrow cursor */
- teinit();
- initdialogs(NULL);
- showcursor();
- myresfile = curresfile();
- getindstring(mytype,200,1);
- getindstring(mystr,200,2);
- myresult = alert(22122,NULL);
- if (myresult == INSTALLITEM)
- install();
- else if (myresult == REMOVEITEM)
- remove();
- hunlock(myhandle);
- }
- ________This_Is_The_END________
- if test `wc -l < install.c` -ne 113; then
- echo 'shar: install.c was damaged during transit'
- echo ' (should have been 113 bytes)'
- fi
- fi ; : end of overwriting check
- echo 'Extracting install.r'
- if test -f install.r; then echo 'shar: will not overwrite install.r'; else
- cat << '________This_Is_The_END________' > install.r
- * Resouces for install
-
- !install
- APPLbrn7
-
- *--------------------------------------------------
-
- TYPE brn7 = STR
- ,0
- Version 1.0 of install
-
-
- TYPE FREF
- ,128
- APPL 0
-
-
- TYPE BNDL
- ,128
- brn7 0
- FREF
- 0 128
- ICN#
- 0 128
-
- TYPE STR#
- ,200 ;; resource ID
- 2 ;; number of strings
- INIT
- Reg Error Box
-
-
- TYPE ICN# = GNRL
-
- ,128
- .H
- 00000000
- 00000000
- 00000000
- 00000000
- 00000000
- 00000000
- FFFFFFFF
- 80000001
- 9FF80001
- 80000001
- B7CDF37D
- 80000001
- B7CDF37D
- 80000001
- B7CDF37D
- 80000001
- B7CDF37D
- 80000001
- B7CDF37D
- 80000001
- 9F1F1F01
- AAAAAA81
- B5B5B581
- 9F1F1F01
- 80000001
- FFFFFFFF
- 00000000
- 00000000
- 00000000
- 00000000
- 00000000
- 00000000
- *
- 00000000
- 00000000
- 00000000
- 00000000
- 00000000
- 00000000
- FFFFFFFF
- FFFFFFFF
- FFFFFFFF
- FFFFFFFF
- FFFFFFFF
- FFFFFFFF
- FFFFFFFF
- FFFFFFFF
- FFFFFFFF
- FFFFFFFF
- FFFFFFFF
- FFFFFFFF
- FFFFFFFF
- FFFFFFFF
- FFFFFFFF
- FFFFFFFF
- FFFFFFFF
- FFFFFFFF
- FFFFFFFF
- FFFFFFFF
- 00000000
- 00000000
- 00000000
- 00000000
- 00000000
- 00000000
- ________This_Is_The_END________
- if test `wc -l < install.r` -ne 101; then
- echo 'shar: install.r was damaged during transit'
- echo ' (should have been 101 bytes)'
- fi
- fi ; : end of overwriting check
- exit 0
-