Permalink
Browse files

Remove trailing whitespace

  • Loading branch information...
1 parent 7ca14bc commit 37172408a6785558acc713eae953c43537a1d9c8 @matthiasl committed Aug 19, 2013
Showing with 66 additions and 66 deletions.
  1. +20 −20 c/duplex_lapd.c
  2. +6 −6 c/gth_win32_compat.h
  3. +13 −13 c/install_release.c
  4. +9 −9 c/install_start_script.c
  5. +8 −8 c/monitor_dtmf.c
  6. +10 −10 c/playback_file.c
View
@@ -1,5 +1,5 @@
//----------------------------------------------------------------------
-// An example program.
+// An example program.
//
// Shows how to start duplex LAPD on a GTH, e.g. for making outgoing calls.
@@ -24,7 +24,7 @@
// * Neither the name of Corelatus nor the
// names of its contributors may be used to endorse or promote products
// derived from this software without specific prior written permission.
-//
+//
// THIS SOFTWARE IS PROVIDED BY Corelatus ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
@@ -35,7 +35,7 @@
// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
+//
//----------------------------------------------------------------------
#include <stdio.h>
#include <stdlib.h>
@@ -87,7 +87,7 @@ typedef struct {
} GTH_lapd_tx_su;
void usage() {
- fprintf(stderr,
+ fprintf(stderr,
"duplex_lapd [-v] <GTH-IP> <span> <timeslot> [<end>]\n\n"
"Enable ISDN LAPD on the specified timeslot.\n\n"
"-v: print the API commands and responses (verbose)\n"
@@ -97,26 +97,26 @@ void usage() {
"<end> is either 'user' (default) or 'network'\n");
fprintf(stderr, "Typical use:\n");
fprintf(stderr, "./duplex_lapd 172.16.1.10 1A 16\n");
-
+
exit(-1);
}
// Start up L1 on the given span. It defaults to E1/doubleframe. We
// disable the TX pins since we're only listening.
-static void enable_l1(GTH_api *api, const char* span)
+static void enable_l1(GTH_api *api, const char* span)
{
int result;
char pcm_name[20];
// E1s carring ISDN LAPD normally use multiframe
- GTH_attribute attributes[] = { {"status", "enabled"},
+ GTH_attribute attributes[] = { {"status", "enabled"},
{"framing", "multiframe"}
};
assert(sizeof(pcm_name) > (strlen(span) + strlen("pcm")));
strncpy(pcm_name, "pcm", sizeof pcm_name);
strncat(pcm_name, span, sizeof pcm_name);
-
+
result = gth_set(api, pcm_name, attributes, 2);
if (result != 0) {
die("<set> command failed (-v shows more information)");
@@ -131,7 +131,7 @@ static void send_dl_establish_req(int data_socket)
GTH_lapd_tx_su su;
int result;
- // To activate the link, send DL_EST_REQ
+ // To activate the link, send DL_EST_REQ
su.length = htons(6);
su.tag = 0;
su.flags = 0x21;
@@ -159,7 +159,7 @@ static void send_dl_data_req(int data_socket)
}
// Start up duplex LAPD on the given timeslot
-static int setup_lapd(GTH_api *api,
+static int setup_lapd(GTH_api *api,
const char *span,
const int timeslot,
const char *end)
@@ -177,7 +177,7 @@ static int setup_lapd(GTH_api *api,
exit(-1);
}
- result = gth_new_lapd_layer(api, 0, span, timeslot, end, sapi, tei,
+ result = gth_new_lapd_layer(api, 0, span, timeslot, end, sapi, tei,
job_id, api->my_ip, listen_port);
if (result != 0) {
die("starting LAPD failed. (re-run with -v for more information)");
@@ -194,15 +194,15 @@ void read_exact(int fd, char *buf, size_t count) {
while (count > 0) {
this_time = recv(fd, buf, count, 0);
- if (this_time <= 0)
+ if (this_time <= 0)
die("LAPD data socket from GTH unexpectedly closed\n");
count -= this_time;
buf += this_time;
}
}
-// This function is the hook for Q.931. For now, it prints out
+// This function is the hook for Q.931. For now, it prints out
// data and tries to establish a data link.
static void dump_incoming_lapd(int data_socket)
{
@@ -217,7 +217,7 @@ static void dump_incoming_lapd(int data_socket)
read_exact(data_socket, (char *)&length, 2);
length = ntohs(length);
read_exact(data_socket, (char *)&su, length);
-
+
switch (su.opcode)
{
case Q921_DL_ESTABLISH_IND:
@@ -240,7 +240,7 @@ static void dump_incoming_lapd(int data_socket)
case Q921_DL_DATA_IND:
printf("got LAPD payload data, len=%d, hexdump=%2x %2x %2x %2x %2x (%c%c%c%c%c)\n",
- length - 6,
+ length - 6,
su.payload[0], su.payload[1], su.payload[2], su.payload[3], su.payload[4],
su.payload[0], su.payload[1], su.payload[2], su.payload[3], su.payload[4]);
break;
@@ -254,8 +254,8 @@ static void dump_incoming_lapd(int data_socket)
}
}
-// Entry point
-int main(int argc, char** argv)
+// Entry point
+int main(int argc, char** argv)
{
GTH_api api;
int data_socket;
@@ -273,14 +273,14 @@ int main(int argc, char** argv)
argv++;
}
- if (argc != 4 && argc != 5)
+ if (argc != 4 && argc != 5)
{
usage();
}
if (argc == 5)
{
- if (strcmp(argv[4], "user") && strcmp(argv[4], "network"))
+ if (strcmp(argv[4], "user") && strcmp(argv[4], "network"))
{
usage();
}
@@ -294,7 +294,7 @@ int main(int argc, char** argv)
win32_specific_startup();
- // Check a couple of assumptions about type size.
+ // Check a couple of assumptions about type size.
assert(sizeof(unsigned int) == 4);
assert(sizeof(unsigned short) == 2);
View
@@ -1,5 +1,5 @@
// This file collects a few common changes needed to make things compile
-// using
+// using
//
// Case 1. gcc native-compiling on a unix-like system
// Case 2. gcc cross-compiling for win32 (using mingw32msvc-gcc)
@@ -20,11 +20,11 @@
// C. GNU and Microsoft have different mechanisms for packing structures.
//
// Microsoft use #pragma pack(N)
-//
+//
// GNU use __attribute__((__packed__)) but also support Microsoft's
// pragma, but it's unclear whether they always will; GNU don't
// seem to think the #pragma approach is a good idea.
-//
+//
//
//----------------------------------------------------------------------
@@ -46,16 +46,16 @@
// Cases 1 & 2
#else
-// Workalike for Microsoft's variant of fopen()
+// Workalike for Microsoft's variant of fopen()
int fopen_s(FILE **file, const char *filename, const char *mode);
// GCC's pack pragma is a suffix, which is a bit messy.
#define PACK_SUFFIX __attribute__((__packed__))
-#endif
+#endif
//----------------------------------------------------------------------
-// Case 2
+// Case 2
#if ( !defined(_MSC_VER) && defined(WIN32))
// Microsoft's sockets API has different names to the normal API, but
// only if we're cross compiling. (why?)
View
@@ -19,7 +19,7 @@
// * Neither the name of Corelatus nor the
// names of its contributors may be used to endorse or promote products
// derived from this software without specific prior written permission.
-//
+//
// THIS SOFTWARE IS PROVIDED BY Corelatus ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
@@ -42,26 +42,26 @@
#include "gth_apilib.h"
#include "gth_client_xml_parse.h"
-static void usage()
+static void usage()
{
- fprintf(stderr,
+ fprintf(stderr,
"install_release [-v] <GTH-IP> <filename>\n\n"
"installs a software image on a GTH\n\n"
"-v: print the API commands and responses (verbose)\n"
"<GTH-IP> is the GTH's IP address or hostname\n"
"<filename> is the firmware image from www.corelatus.com\n\n"
-
+
"Example: \n"
" ./install_release 172.16.1.10 gth2_system_33c.gth\n\n");
exit(-1);
}
//------------------------------
-static void install_release(const char *hostname,
- const char *filename,
+static void install_release(const char *hostname,
+ const char *filename,
int verbose)
{
GTH_api api;
@@ -77,7 +77,7 @@ static void install_release(const char *hostname,
fprintf(stderr, "installing software image %s\n", filename);
if (!image) die("unable to open software image file");
-
+
fseek(image, 0, SEEK_END);
image_length = ftell(image);
rewind(image);
@@ -86,13 +86,13 @@ static void install_release(const char *hostname,
assert(image_data);
result = fread(image_data, image_length, 1, image);
assert(result == 1);
-
+
fclose(image);
result = gth_set_single(&api, "system_image", "locked", "false");
assert(result == 0);
- result = gth_install(&api, "system_image", "binary/filesystem",
+ result = gth_install(&api, "system_image", "binary/filesystem",
image_data, image_length);
free(image_data);
@@ -111,24 +111,24 @@ static void show_releases(const char *hostname, const int verbose)
die("unable to connect to GTH");
}
- result = gth_query_resource_attribute(&api, "system_image", "version",
+ result = gth_query_resource_attribute(&api, "system_image", "version",
attribute, sizeof(attribute));
assert(result == 0);
printf(" Current system image version: %s\n", attribute);
- result = gth_query_resource_attribute(&api, "failsafe_image", "version",
+ result = gth_query_resource_attribute(&api, "failsafe_image", "version",
attribute, sizeof(attribute));
assert(result == 0);
printf("Current failsafe image version: %s\n", attribute);
-
+
gth_bye(&api);
}
//------------------------------
-int main(int argc, char **argv)
+int main(int argc, char **argv)
{
const char* hostname;
int verbose = 0;
View
@@ -17,7 +17,7 @@
// * Neither the name of Corelatus nor the
// names of its contributors may be used to endorse or promote products
// derived from this software without specific prior written permission.
-//
+//
// THIS SOFTWARE IS PROVIDED BY Corelatus ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
@@ -39,9 +39,9 @@
#include "gth_apilib.h"
#include "gth_client_xml_parse.h"
-static void usage()
+static void usage()
{
- fprintf(stderr,
+ fprintf(stderr,
"install_start_script <GTH-IP> <filename>\n\n"
"Installs a start script on a GTH\n\n"
@@ -55,7 +55,7 @@ static void usage()
}
//------------------------------
-static void install_start_script(const char *hostname,
+static void install_start_script(const char *hostname,
const char *filename,
int verbose)
{
@@ -76,7 +76,7 @@ static void install_start_script(const char *hostname,
if (!script) {
die("unable to open start script file");
}
-
+
fseek(script, 0, SEEK_END);
script_length = ftell(script);
rewind(script);
@@ -85,7 +85,7 @@ static void install_start_script(const char *hostname,
assert(script_data);
result = fread(script_data, script_length, 1, script);
- result = gth_install(&api, "start_script", "binary/file",
+ result = gth_install(&api, "start_script", "binary/file",
script_data, script_length);
free(script_data);
@@ -113,12 +113,12 @@ static void print_e1t1_names(const char *hostname) {
}
gth_free_attributes(attributes, n_attributes);
-
+
gth_bye(&api);
}
//------------------------------
-int main(int argc, char **argv)
+int main(int argc, char **argv)
{
const char* hostname;
int verbose = 0;
@@ -148,7 +148,7 @@ int main(int argc, char **argv)
gth_switch_to(hostname, "system", 1);
// Print the E1/T1 names. Two reasons for doing that. Firstly, so we
- // can see that the GTH isn't running failsafe. Secondly, because
+ // can see that the GTH isn't running failsafe. Secondly, because
// the most common use of a start script is to change the E1/T1 naming.
print_e1t1_names(hostname);
Oops, something went wrong.

0 comments on commit 3717240

Please sign in to comment.