/* * Hamlib Interface - sprintf toolbox * Copyright (c) 2000-2004 by Stephane Fillod and Frank Singleton * * $Id: sprintflst.c,v 1.5 2004-05-17 21:09:45 fillods Exp $ * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as * published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include /* Standard input/output definitions */ #include /* String function definitions */ #include /* UNIX standard function definitions */ #include #include #include #include "sprintflst.h" #include "misc.h" /* #define DUMMY_ALL 0x7ffffffffffffffLL */ #define DUMMY_ALL ((setting_t)-1) int sprintf_vfo(char *str, vfo_t vfo) { int i, len=0; const char *sv; *str = '\0'; if (vfo == RIG_VFO_NONE) return 0; sv = rig_strvfo(vfo & RIG_VFO_CURR); if (sv && sv[0]) len += sprintf(str+len, "%s ", sv); sv = rig_strvfo(vfo & RIG_VFO_MEM); if (sv && sv[0]) len += sprintf(str+len, "%s ", sv); sv = rig_strvfo(vfo & RIG_VFO_VFO); if (sv && sv[0]) len += sprintf(str+len, "%s ", sv); sv = rig_strvfo(vfo & RIG_VFO_MAIN); if (sv && sv[0]) len += sprintf(str+len, "%s ", sv); sv = rig_strvfo(vfo & RIG_VFO_SUB); if (sv && sv[0]) len += sprintf(str+len, "%s ", sv); for (i=0; i<16; i++) { sv = rig_strvfo(vfo & RIG_VFO_N(i)); if (sv && sv[0]) len += sprintf(str+len, "%s ", sv); } return len; } int sprintf_mode(char *str, rmode_t mode) { int i, len=0; *str = '\0'; if (mode == RIG_MODE_NONE) return 0; for (i = 0; i < 30; i++) { const char *ms = rig_strrmode(mode & (1UL<