MCPcopy Create free account
hub / github.com/Hamlib/Hamlib / usage_rig

Function usage_rig

tests/rigctl_parse.c:1981–2041  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1979
1980
1981void usage_rig(FILE *fout)
1982{
1983 int i;
1984 int column = 1;
1985 int wrapped = 0;
1986
1987 fprintf(fout, "Commands (some may not be available for this rig):\n");
1988
1989 for (i = 0; test_list[i].cmd != 0; i++)
1990 {
1991 int nbspaces = 20; // longest arguments are 32 chars: "TX Frequency,TX Mode,TX Passband"
1992 fprintf(fout,
1993 "%c: %-19s(", // longest commands are 19 chars, eg. "set_split_freq_mode"
1994 isprint(test_list[i].cmd) ? test_list[i].cmd : '?',
1995 test_list[i].name);
1996
1997
1998 if (test_list[i].arg1 && (test_list[i].flags & ARG_IN1))
1999 {
2000 nbspaces -= fprintf(fout, "%s", test_list[i].arg1);
2001 }
2002
2003 if (test_list[i].arg2 && (test_list[i].flags & ARG_IN2))
2004 {
2005 nbspaces -= fprintf(fout, ",%s", test_list[i].arg2);
2006 }
2007
2008 if (test_list[i].arg3 && (test_list[i].flags & ARG_IN3))
2009 {
2010 nbspaces -= fprintf(fout, ",%s", test_list[i].arg3);
2011 }
2012
2013 if ((nbspaces < 1) || (column == 2) || wrapped)
2014 {
2015 fprintf(fout, ")\n");
2016 wrapped = (nbspaces < 1) && (column == 1);
2017 column = 1;
2018 }
2019 else
2020 {
2021 fprintf(fout, ")%*s", nbspaces, " ");
2022 column++;
2023 }
2024 }
2025
2026 fprintf(fout,
2027 "\n\nIn interactive mode prefix long command names with '\\', e.g. '\\dump_state'\n\n"
2028 "The special command '-' is used to read further commands from standard input\n"
2029 "Commands and arguments read from standard input must be white space separated,\n"
2030 "comments are allowed, comments start with the # character and continue to the\n"
2031 "end of the line.\n");
2032
2033 fprintf(fout, "\nError codes and messages\n");
2034
2035 for (enum rig_errcode_e e = 0; e < RIG_EEND; ++e)
2036 {
2037 fprintf(fout, "-%d - %s", e, rigerror2(e));
2038 }

Callers 4

usageFunction · 0.85
usageFunction · 0.85
usageFunction · 0.85
rigctl_parseFunction · 0.85

Calls 1

rigerror2Function · 0.85

Tested by

no test coverage detected