blob: 2ecba3da691907939e99ecfc8d2cc114de6f10e0 [file] [log] [blame]
nethercote5912c812004-02-15 15:38:08 +00001/* This file is part of hp2ps, a graph drawer for memory profiles.
2 Copyright (C) 2002 The University Court of the University of Glasgow.
3 This program is governed by the license contained in the file LICENSE. */
4
nethercotea0b77912004-06-02 20:43:24 +00005#include <stdarg.h>
nethercotec9f36922004-02-14 16:40:02 +00006#include <stdio.h>
nethercotea0b77912004-06-02 20:43:24 +00007#include <stdlib.h>
nethercotec9f36922004-02-14 16:40:02 +00008#include "Main.h"
9#include "Defines.h"
10
11/* own stuff */
12#include "Error.h"
13
nethercotec9f36922004-02-14 16:40:02 +000014/*VARARGS0*/
15void
nethercotea0b77912004-06-02 20:43:24 +000016Error(const char *fmt, ...)
nethercotec9f36922004-02-14 16:40:02 +000017{
nethercotea0b77912004-06-02 20:43:24 +000018 va_list ap;
nethercotec9f36922004-02-14 16:40:02 +000019 fflush(stdout);
20 fprintf(stderr, "%s: ", programname);
nethercotea0b77912004-06-02 20:43:24 +000021 va_start(ap, fmt);
22 vfprintf(stderr, fmt, ap);
23 va_end(ap);
nethercotec9f36922004-02-14 16:40:02 +000024 fprintf(stderr, "\n");
25 exit(1);
26}
27
28/*VARARGS0*/
29void
nethercotea0b77912004-06-02 20:43:24 +000030Disaster(const char *fmt, ...)
nethercotec9f36922004-02-14 16:40:02 +000031{
nethercotea0b77912004-06-02 20:43:24 +000032 va_list ap;
nethercotec9f36922004-02-14 16:40:02 +000033 fflush(stdout);
34 fprintf(stderr, "%s: ", programname);
nethercotea0b77912004-06-02 20:43:24 +000035 fprintf(stderr, " Disaster! (");
36 va_start(ap, fmt);
37 vfprintf(stderr, fmt, ap);
38 va_end(ap);
nethercotec9f36922004-02-14 16:40:02 +000039 fprintf(stderr, ")\n");
40 exit(1);
41}
42
43void
44Usage(str)
nethercotea0b77912004-06-02 20:43:24 +000045 const char *str;
nethercotec9f36922004-02-14 16:40:02 +000046{
47 if (str) printf("error: %s\n", str);
48 printf("usage: %s -b -d -ef -g -i -p -mn -p -s -tf -y [file[.hp]]\n", programname);
49 printf("where -b use large title box\n");
50 printf(" -d sort by standard deviation\n");
51 printf(" -ef[in|mm|pt] produce Encapsulated PostScript f units wide (f > 2 inches)\n");
52 printf(" -g produce output suitable for GHOSTSCRIPT previever\n");
53 printf(" -i[+|-] sort by identifier string (-i+ gives greatest on top) \n");
54 printf(" -mn print maximum of n bands (default & max 20)\n");
55 printf(" -m0 removes the band limit altogether\n");
56 printf(" -p use previous scaling, shading and ordering\n");
57 printf(" -s use small title box\n");
58 printf(" -tf ignore trace bands which sum below f%% (default 1%%, max 5%%)\n");
59 printf(" -y traditional\n");
60 printf(" -c colour ouput\n");
61 exit(0);
62}
63