| Revision 1404,
1.3 KB
checked in by stefanct, 6 months ago
(diff) |
|
Introduce msg_*dbg2
Signed-off-by: Stefan Tauner <stefan.tauner@…>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@…>
|
| Line | |
|---|
| 1 | /* |
|---|
| 2 | * This file is part of the flashrom project. |
|---|
| 3 | * |
|---|
| 4 | * Copyright (C) 2009 Sean Nelson <audiohacked@gmail.com> |
|---|
| 5 | * |
|---|
| 6 | * This program is free software; you can redistribute it and/or modify |
|---|
| 7 | * it under the terms of the GNU General Public License as published by |
|---|
| 8 | * the Free Software Foundation; either version 2 of the License, or |
|---|
| 9 | * (at your option) any later version. |
|---|
| 10 | * |
|---|
| 11 | * This program is distributed in the hope that it will be useful, |
|---|
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 14 | * GNU General Public License for more details. |
|---|
| 15 | * |
|---|
| 16 | * You should have received a copy of the GNU General Public License |
|---|
| 17 | * along with this program; if not, write to the Free Software |
|---|
| 18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|---|
| 19 | */ |
|---|
| 20 | |
|---|
| 21 | #include <stdio.h> |
|---|
| 22 | #include <stdarg.h> |
|---|
| 23 | #include "flash.h" |
|---|
| 24 | |
|---|
| 25 | int print(int type, const char *fmt, ...) |
|---|
| 26 | { |
|---|
| 27 | va_list ap; |
|---|
| 28 | int ret; |
|---|
| 29 | FILE *output_type; |
|---|
| 30 | |
|---|
| 31 | switch (type) { |
|---|
| 32 | case MSG_ERROR: |
|---|
| 33 | output_type = stderr; |
|---|
| 34 | break; |
|---|
| 35 | case MSG_BARF: |
|---|
| 36 | if (verbose < 3) |
|---|
| 37 | return 0; |
|---|
| 38 | case MSG_DEBUG2: |
|---|
| 39 | if (verbose < 2) |
|---|
| 40 | return 0; |
|---|
| 41 | case MSG_DEBUG: |
|---|
| 42 | if (verbose < 1) |
|---|
| 43 | return 0; |
|---|
| 44 | case MSG_INFO: |
|---|
| 45 | default: |
|---|
| 46 | output_type = stdout; |
|---|
| 47 | break; |
|---|
| 48 | } |
|---|
| 49 | |
|---|
| 50 | va_start(ap, fmt); |
|---|
| 51 | ret = vfprintf(output_type, fmt, ap); |
|---|
| 52 | va_end(ap); |
|---|
| 53 | fflush(output_type); |
|---|
| 54 | return ret; |
|---|
| 55 | } |
|---|
Note: See
TracBrowser
for help on using the repository browser.