nethercote | 5912c81 | 2004-02-15 15:38:08 +0000 | [diff] [blame] | 1 | /* 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 | |
nethercote | a0b7791 | 2004-06-02 20:43:24 +0000 | [diff] [blame] | 5 | #include <stdarg.h> |
nethercote | c9f3692 | 2004-02-14 16:40:02 +0000 | [diff] [blame] | 6 | #include <stdio.h> |
nethercote | a0b7791 | 2004-06-02 20:43:24 +0000 | [diff] [blame] | 7 | #include <stdlib.h> |
nethercote | c9f3692 | 2004-02-14 16:40:02 +0000 | [diff] [blame] | 8 | #include "Main.h" |
| 9 | #include "Defines.h" |
| 10 | |
| 11 | /* own stuff */ |
| 12 | #include "Error.h" |
| 13 | |
nethercote | c9f3692 | 2004-02-14 16:40:02 +0000 | [diff] [blame] | 14 | /*VARARGS0*/ |
| 15 | void |
nethercote | a0b7791 | 2004-06-02 20:43:24 +0000 | [diff] [blame] | 16 | Error(const char *fmt, ...) |
nethercote | c9f3692 | 2004-02-14 16:40:02 +0000 | [diff] [blame] | 17 | { |
nethercote | a0b7791 | 2004-06-02 20:43:24 +0000 | [diff] [blame] | 18 | va_list ap; |
nethercote | c9f3692 | 2004-02-14 16:40:02 +0000 | [diff] [blame] | 19 | fflush(stdout); |
| 20 | fprintf(stderr, "%s: ", programname); |
nethercote | a0b7791 | 2004-06-02 20:43:24 +0000 | [diff] [blame] | 21 | va_start(ap, fmt); |
| 22 | vfprintf(stderr, fmt, ap); |
| 23 | va_end(ap); |
nethercote | c9f3692 | 2004-02-14 16:40:02 +0000 | [diff] [blame] | 24 | fprintf(stderr, "\n"); |
| 25 | exit(1); |
| 26 | } |
| 27 | |
| 28 | /*VARARGS0*/ |
| 29 | void |
nethercote | a0b7791 | 2004-06-02 20:43:24 +0000 | [diff] [blame] | 30 | Disaster(const char *fmt, ...) |
nethercote | c9f3692 | 2004-02-14 16:40:02 +0000 | [diff] [blame] | 31 | { |
nethercote | a0b7791 | 2004-06-02 20:43:24 +0000 | [diff] [blame] | 32 | va_list ap; |
nethercote | c9f3692 | 2004-02-14 16:40:02 +0000 | [diff] [blame] | 33 | fflush(stdout); |
| 34 | fprintf(stderr, "%s: ", programname); |
nethercote | a0b7791 | 2004-06-02 20:43:24 +0000 | [diff] [blame] | 35 | fprintf(stderr, " Disaster! ("); |
| 36 | va_start(ap, fmt); |
| 37 | vfprintf(stderr, fmt, ap); |
| 38 | va_end(ap); |
nethercote | c9f3692 | 2004-02-14 16:40:02 +0000 | [diff] [blame] | 39 | fprintf(stderr, ")\n"); |
| 40 | exit(1); |
| 41 | } |
| 42 | |
| 43 | void |
| 44 | Usage(str) |
nethercote | a0b7791 | 2004-06-02 20:43:24 +0000 | [diff] [blame] | 45 | const char *str; |
nethercote | c9f3692 | 2004-02-14 16:40:02 +0000 | [diff] [blame] | 46 | { |
| 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 | |