Update README to say GPLv2 or later and remove references to bzr.
[jerry/slag.git] / win32 / spoolss / DeleteForm.c
1 /******************************************************************\r
2  * SPOOLSS regression testing code for Samba print servers\r
3  * \r
4  *****************************************************************/\r
5 \r
6 #include <windows.h>\r
7 #include <stdio.h>\r
8 #include "printlib.h"\r
9 \r
10 \r
11 int main (int argc, char* argv[])\r
12 {\r
13         \r
14         HANDLE                  printer;\r
15         LPVOID                  lpMsgBuf;\r
16 \r
17         if (argc < 2)\r
18         {\r
19                 fprintf (stderr, "useage: %s <printername> <form name>\n", argv[0]);\r
20                 exit (-1);\r
21         }\r
22 \r
23         /* open the printer */\r
24         if (!OpenPrinter (argv[1], &printer, NULL))\r
25         {\r
26                 fprintf (stderr, "Unable to open %s!\n", argv[1]);\r
27                 exit (-1);\r
28         }\r
29         else\r
30         {\r
31                 printf ("Printer [%s] opened successfully.\n\n", argv[1]);\r
32         }\r
33 \r
34         printf ("Attempting to remove %s...\n", argv[2]);\r
35         if (!DeleteForm(printer, (LPTSTR)argv[2]))\r
36         {\r
37                 FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | \r
38                         FORMAT_MESSAGE_IGNORE_INSERTS, NULL, GetLastError(),\r
39                         MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language\r
40                         (LPTSTR) &lpMsgBuf, 0, NULL);\r
41                 printf ("ERROR : %s\n", (char*)lpMsgBuf);\r
42                 LocalFree (lpMsgBuf);\r
43         }\r
44         else\r
45         {\r
46                 printf ("Form removed successfully!\n");\r
47         }\r
48         printf ("\n");\r
49 \r
50 \r
51         /* close the printer */\r
52         if (!ClosePrinter(printer))\r
53         {\r
54                 fprintf (stderr, "Error closing printer!\n");\r
55                 exit (-1);\r
56         }\r
57         else\r
58         {\r
59                 printf ("Printer [%s] closed successfully.\n", argv[1]);\r
60         }\r
61 \r
62         return 0;\r
63 \r
64 }