File: uninst.c

package info (click to toggle)
freetype 1.3.1-1
  • links: PTS
  • area: main
  • in suites: potato
  • size: 6,652 kB
  • ctags: 6,860
  • sloc: ansic: 47,576; pascal: 13,773; sh: 7,513; makefile: 786; cpp: 351; csh: 53; perl: 13
file content (60 lines) | stat: -rw-r--r-- 1,855 bytes parent folder | download | duplicates (11)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/*                                                                  */
/*                  UNINST - FreeType/2 uninstaller                 */
/*                                                                  */
/*          Copyright 1998 Michal Necasek <mike@mendelu.cz>         */
/*                                                                  */
/* UNINSTALL.CMD rewritten in C - apparently the REXX version fails */
/* when OS/2 is booted to command line. This causes problems if     */
/* FreeType/2 prevents PM from starting successfully.               */
/*                                                                  */
/* Note: This can be compiled as 16-bit app to keep the size down.  */

#define  INCL_NOXLATE_WIN16
#define  INCL_NOXLATE_DOS16
#define  INCL_WINSHELLDATA
#define  INCL_DOSMISC
#include <os2.h>

#include <stdio.h>
#include <string.h>
#include <conio.h>

char szApp[] = "PM_Font_Drivers";
char szKey[] = "TRUETYPE";
char szBuffer[300];

void main(void) {
   ULONG  ulBootDrv;
   USHORT usLen = 0;
   APIRET rc;
   char   c;

   usLen = PrfQueryProfileString(HINI_USERPROFILE, szApp, szKey, NULL,
                                 (PVOID)szBuffer, 260L);

   if (!strcmp("\\OS2\\DLL\\FREETYPE.DLL", szBuffer)) {
      if(!PrfWriteProfileString(HINI_USERPROFILE, szApp, szKey, NULL))
         goto err;

      printf("FreeType/2 successfully removed.\n");
      printf("Do you wish to restore TRUETYPE.DLL (y/n)? ");
      c = getch();
      if (c != 'y' && c != 'Y')
         return;

      if(!PrfWriteProfileString(HINI_USERPROFILE, szApp, szKey,
                                 "\\OS2\\DLL\\TRUETYPE.DLL"))
         goto err;

      printf("\nTRUETYPE.DLL successfully restored");
   }
   else {
      printf("FreeType/2 not installed!");
      return;
   }

   return;

err:
   printf("Uninstallation failed!");
}