Clean up modelines and indentation.

To quote Icf0831717de10fc615971fa1cf75af2f1ea2d03d:

HT tab stops are set every 8 spaces on UN*X; UN*X tools that treat an HT
character as tabbing to 4-space tab stops, or that even are configurable
but *default* to 4-space tab stops (I'm looking at *you*, Xcode!) are
broken. tab-width: 4, tabstop=4, and tabSize=4 are errors if you ever
expect anybody to look at your file with a UN*X tool, and every text
file will probably be looked at by a UN*X tool at some point, so Don't
Do That.

Adjust indentation to reflect the mode lines.

Change-Id: Ic829541c696e0ddbc45cc109009319859c799066
Reviewed-on: https://code.wireshark.org/review/14340
Reviewed-by: Jeff Morriss <jeff.morriss.ws@gmail.com>
This commit is contained in:
Jeff Morriss 2016-03-04 09:26:00 -05:00
parent 637aefd2b3
commit ab5614ae10
5 changed files with 204 additions and 204 deletions

View File

@ -2605,6 +2605,6 @@ void proto_reg_handoff_pcp(void)
* indent-tabs-mode: nil
* End:
*
* vi: set shiftwidth=4 tabstop=4 expandtab:
* vi: set shiftwidth=4 tabstop=8 expandtab:
* :indentSize=4:tabSize=8:noTabs=true:
*/

View File

@ -37,9 +37,9 @@
* cog.py -D xmlfile=tools/SkinnyProtocolOptimized.xml -d -c -o epan/dissectors/packet-skinny.c epan/dissectors/packet-skinny.c.in
*/
/* c-basic-offset: 2; tab-width: 2; indent-tabs-mode: nil
* vi: set shiftwidth=2 tabstop=2 expandtab:
* :indentSize=2:tabSize=2:noTabs=true:
/* c-basic-offset: 2; tab-width: 8; indent-tabs-mode: nil
* vi: set shiftwidth=2 tabstop=8 expandtab:
* :indentSize=2:tabSize=8:noTabs=true:
*/
#include "config.h"
@ -9748,10 +9748,10 @@ proto_reg_handoff_skinny(void)
*
* Local variables:
* c-basic-offset: 2
* tab-width: 2
* tab-width: 8
* indent-tabs-mode: nil
* End:
*
* vi: set shiftwidth=2 tabstop=2 expandtab:
* :indentSize=2:tabSize=2:noTabs=true:
* vi: set shiftwidth=2 tabstop=8 expandtab:
* :indentSize=2:tabSize=8:noTabs=true:
*/

View File

@ -50,9 +50,9 @@ cog.out(' */\n')
/*[[[end]]]*/
/* c-basic-offset: 2; tab-width: 2; indent-tabs-mode: nil
* vi: set shiftwidth=2 tabstop=2 expandtab:
* :indentSize=2:tabSize=2:noTabs=true:
/* c-basic-offset: 2; tab-width: 8; indent-tabs-mode: nil
* vi: set shiftwidth=2 tabstop=8 expandtab:
* :indentSize=2:tabSize=8:noTabs=true:
*/
#include "config.h"
@ -551,10 +551,10 @@ proto_reg_handoff_skinny(void)
*
* Local variables:
* c-basic-offset: 2
* tab-width: 2
* tab-width: 8
* indent-tabs-mode: nil
* End:
*
* vi: set shiftwidth=2 tabstop=2 expandtab:
* :indentSize=2:tabSize=2:noTabs=true:
* vi: set shiftwidth=2 tabstop=8 expandtab:
* :indentSize=2:tabSize=8:noTabs=true:
*/

View File

@ -31,235 +31,235 @@
#include <string.h>
#ifdef HAVE_GETOPT_H
#include <getopt.h>
#include <getopt.h>
#endif
#ifndef HAVE_GETOPT_LONG
#include "wsutil/wsgetopt.h"
#include "wsutil/wsgetopt.h"
#endif
enum extcap_options {
EXTCAP_BASE_OPTIONS_ENUM
EXTCAP_BASE_OPTIONS_ENUM
};
typedef struct _extcap_interface
{
char * interface;
char * description;
char * interface;
char * description;
uint16_t dlt;
char * dltname;
char * dltdescription;
uint16_t dlt;
char * dltname;
char * dltdescription;
} extcap_interface;
#ifdef _WIN32
BOOLEAN IsHandleRedirected(DWORD handle)
{
HANDLE h = GetStdHandle(handle);
if (h) {
BY_HANDLE_FILE_INFORMATION fi;
if (GetFileInformationByHandle(h, &fi)) {
return TRUE;
}
HANDLE h = GetStdHandle(handle);
if (h) {
BY_HANDLE_FILE_INFORMATION fi;
if (GetFileInformationByHandle(h, &fi)) {
return TRUE;
}
return FALSE;
}
return FALSE;
}
void attach_parent_console()
{
BOOL outRedirected, errRedirected;
BOOL outRedirected, errRedirected;
outRedirected = IsHandleRedirected(STD_OUTPUT_HANDLE);
errRedirected = IsHandleRedirected(STD_ERROR_HANDLE);
outRedirected = IsHandleRedirected(STD_OUTPUT_HANDLE);
errRedirected = IsHandleRedirected(STD_ERROR_HANDLE);
if (outRedirected && errRedirected) {
/* Both standard output and error handles are redirected.
* There is no point in attaching to parent process console.
*/
return;
if (outRedirected && errRedirected) {
/* Both standard output and error handles are redirected.
* There is no point in attaching to parent process console.
*/
return;
}
if (AttachConsole(ATTACH_PARENT_PROCESS) == 0) {
/* Console attach failed. */
return;
}
/* Console attach succeeded */
if (outRedirected == FALSE) {
if (!freopen("CONOUT$", "w", stdout)) {
errmsg_print("WARNING: Cannot redirect to stdout.");
}
}
if (AttachConsole(ATTACH_PARENT_PROCESS) == 0) {
/* Console attach failed. */
return;
}
/* Console attach succeeded */
if (outRedirected == FALSE) {
if (!freopen("CONOUT$", "w", stdout)) {
errmsg_print("WARNING: Cannot redirect to stdout.");
}
}
if (errRedirected == FALSE) {
if (!freopen("CONOUT$", "w", stderr)) {
errmsg_print("WARNING: Cannot redirect to strerr.");
}
if (errRedirected == FALSE) {
if (!freopen("CONOUT$", "w", stderr)) {
errmsg_print("WARNING: Cannot redirect to strerr.");
}
}
}
#endif
void extcap_base_register_interface(extcap_parameters * extcap, const char * interface, const char * ifdescription, uint16_t dlt, const char * dltdescription )
{
extcap_base_register_interface_ext(extcap, interface, ifdescription, dlt, NULL, dltdescription );
extcap_base_register_interface_ext(extcap, interface, ifdescription, dlt, NULL, dltdescription );
}
void extcap_base_register_interface_ext(extcap_parameters * extcap,
const char * interface, const char * ifdescription,
uint16_t dlt, const char * dltname, const char * dltdescription )
{
extcap_interface * iface = g_new0(extcap_interface, 1);
extcap_interface * iface = g_new0(extcap_interface, 1);
if (interface == NULL)
return;
if (interface == NULL)
return;
iface->interface = g_strdup(interface);
iface->description = g_strdup(ifdescription);
iface->dlt = dlt;
iface->dltname = g_strdup(dltname);
iface->dltdescription = g_strdup(dltdescription);
iface->interface = g_strdup(interface);
iface->description = g_strdup(ifdescription);
iface->dlt = dlt;
iface->dltname = g_strdup(dltname);
iface->dltdescription = g_strdup(dltdescription);
extcap->interfaces = g_list_append(extcap->interfaces, (gpointer) iface);
extcap->interfaces = g_list_append(extcap->interfaces, (gpointer) iface);
}
void extcap_base_set_util_info(extcap_parameters * extcap, const char * major, const char * minor, const char * release, const char * helppage)
{
g_assert(major);
extcap->version = g_strdup_printf("%s%s%s%s%s",
major,
minor ? "." : "",
minor ? minor : "",
release ? "." : "",
release ? release : "");
extcap->helppage = g_strdup(helppage);
g_assert(major);
extcap->version = g_strdup_printf("%s%s%s%s%s",
major,
minor ? "." : "",
minor ? minor : "",
release ? "." : "",
release ? release : "");
extcap->helppage = g_strdup(helppage);
}
uint8_t extcap_base_parse_options(extcap_parameters * extcap, int result, char * optargument )
{
switch (result) {
case EXTCAP_OPT_LIST_INTERFACES:
extcap->do_list_interfaces = 1;
break;
case EXTCAP_OPT_VERSION:
extcap->do_version = 1;
break;
case EXTCAP_OPT_LIST_DLTS:
extcap->do_list_dlts = 1;
break;
case EXTCAP_OPT_INTERFACE:
extcap->interface = g_strdup(optargument);
break;
case EXTCAP_OPT_CONFIG:
extcap->show_config = 1;
break;
case EXTCAP_OPT_CAPTURE:
extcap->capture = 1;
break;
case EXTCAP_OPT_CAPTURE_FILTER:
extcap->capture_filter = g_strdup(optargument);
break;
case EXTCAP_OPT_FIFO:
extcap->fifo = g_strdup(optargument);
break;
}
switch (result) {
case EXTCAP_OPT_LIST_INTERFACES:
extcap->do_list_interfaces = 1;
break;
case EXTCAP_OPT_VERSION:
extcap->do_version = 1;
break;
case EXTCAP_OPT_LIST_DLTS:
extcap->do_list_dlts = 1;
break;
case EXTCAP_OPT_INTERFACE:
extcap->interface = g_strdup(optargument);
break;
case EXTCAP_OPT_CONFIG:
extcap->show_config = 1;
break;
case EXTCAP_OPT_CAPTURE:
extcap->capture = 1;
break;
case EXTCAP_OPT_CAPTURE_FILTER:
extcap->capture_filter = g_strdup(optargument);
break;
case EXTCAP_OPT_FIFO:
extcap->fifo = g_strdup(optargument);
break;
}
return 1;
return 1;
}
static void extcap_iface_print(gpointer data, gpointer userdata _U_)
{
extcap_interface * iface = (extcap_interface *)data;
extcap_interface * iface = (extcap_interface *)data;
printf("interface {value=%s}", iface->interface);
if (iface->description != NULL)
printf ("{display=%s}\n", iface->description);
else
printf ("\n");
printf("interface {value=%s}", iface->interface);
if (iface->description != NULL)
printf ("{display=%s}\n", iface->description);
else
printf ("\n");
}
static gint extcap_iface_compare(gconstpointer a, gconstpointer b)
{
extcap_interface * iface_a = (extcap_interface *)a;
extcap_interface * iface_a = (extcap_interface *)a;
return (g_strcmp0(iface_a->interface, (char *) b));
return (g_strcmp0(iface_a->interface, (char *) b));
}
static void extcap_print_version(extcap_parameters * extcap)
{
printf("extcap {version=%s}", extcap->version != NULL ? extcap->version : "unknown");
if (extcap->helppage != NULL)
printf("{help=%s}", extcap->helppage);
printf("\n");
printf("extcap {version=%s}", extcap->version != NULL ? extcap->version : "unknown");
if (extcap->helppage != NULL)
printf("{help=%s}", extcap->helppage);
printf("\n");
}
static gint extcap_iface_listall(extcap_parameters * extcap, uint8_t list_ifs)
{
if (list_ifs) {
extcap_print_version(extcap);
g_list_foreach(extcap->interfaces, extcap_iface_print, extcap);
if (list_ifs) {
extcap_print_version(extcap);
g_list_foreach(extcap->interfaces, extcap_iface_print, extcap);
} else {
if (extcap->do_version) {
extcap_print_version(extcap);
} else {
if (extcap->do_version) {
extcap_print_version(extcap);
} else {
GList * element = NULL;
extcap_interface * iface = NULL;
if ((element = g_list_find_custom(extcap->interfaces, extcap->interface, extcap_iface_compare)) == NULL)
return 0;
GList * element = NULL;
extcap_interface * iface = NULL;
if ((element = g_list_find_custom(extcap->interfaces, extcap->interface, extcap_iface_compare)) == NULL)
return 0;
iface = (extcap_interface *) element->data;
printf("dlt {number=%d}{name=%s}", iface->dlt, iface->dltname != NULL ? iface->dltname : iface->interface);
if (iface->description != NULL)
printf ("{display=%s}\n", iface->dltdescription);
else
printf ("\n");
}
iface = (extcap_interface *) element->data;
printf("dlt {number=%d}{name=%s}", iface->dlt, iface->dltname != NULL ? iface->dltname : iface->interface);
if (iface->description != NULL)
printf ("{display=%s}\n", iface->dltdescription);
else
printf ("\n");
}
}
return 1;
return 1;
}
uint8_t extcap_base_handle_interface(extcap_parameters * extcap)
{
/* A fifo must be provided for capture */
if (extcap->capture && (extcap->fifo == NULL || strlen(extcap->fifo) <= 0)) {
extcap->capture = 0;
errmsg_print("Extcap Error: No FIFO pipe provided");
return 0;
}
if (extcap->do_list_interfaces) {
return extcap_iface_listall(extcap, 1);
} else if (extcap->do_version || extcap->do_list_dlts) {
return extcap_iface_listall(extcap, 0);
} else {
/* An interface must exist */
if (g_list_find_custom(extcap->interfaces, extcap->interface, extcap_iface_compare) == NULL) {
errmsg_print("Extcap Error: No interface [%s] provided", extcap->interface);
return 0;
}
}
/* A fifo must be provided for capture */
if (extcap->capture && (extcap->fifo == NULL || strlen(extcap->fifo) <= 0)) {
extcap->capture = 0;
errmsg_print("Extcap Error: No FIFO pipe provided");
return 0;
}
if (extcap->do_list_interfaces) {
return extcap_iface_listall(extcap, 1);
} else if (extcap->do_version || extcap->do_list_dlts) {
return extcap_iface_listall(extcap, 0);
} else {
/* An interface must exist */
if (g_list_find_custom(extcap->interfaces, extcap->interface, extcap_iface_compare) == NULL) {
errmsg_print("Extcap Error: No interface [%s] provided", extcap->interface);
return 0;
}
}
return 0;
}
static void extcap_iface_free(gpointer data)
{
extcap_interface * iface = (extcap_interface *)data;
g_free(iface->interface);
g_free(iface->description);
g_free(iface->dltname);
g_free(iface->dltdescription);
extcap_interface * iface = (extcap_interface *)data;
g_free(iface->interface);
g_free(iface->description);
g_free(iface->dltname);
g_free(iface->dltdescription);
}
void extcap_base_cleanup(extcap_parameters ** extcap)
{
g_list_free_full((*extcap)->interfaces, extcap_iface_free);
g_free((*extcap)->fifo);
g_free((*extcap)->interface);
g_free((*extcap)->version);
g_free((*extcap)->helppage);
g_free(*extcap);
*extcap = NULL;
g_list_free_full((*extcap)->interfaces, extcap_iface_free);
g_free((*extcap)->fifo);
g_free((*extcap)->interface);
g_free((*extcap)->version);
g_free((*extcap)->helppage);
g_free(*extcap);
*extcap = NULL;
}
/*
@ -267,10 +267,10 @@ void extcap_base_cleanup(extcap_parameters ** extcap)
*
* Local variables:
* c-basic-offset: 4
* tab-width: 4
* tab-width: 8
* indent-tabs-mode: t
* End:
*
* vi: set shiftwidth=4 tabstop=4 noexpandtab:
* :indentSize=4:tabSize=4:noTabs=false:
* vi: set shiftwidth=4 tabstop=8 noexpandtab:
* :indentSize=4:tabSize=8:noTabs=false:
*/

View File

@ -30,66 +30,66 @@
#include <wsutil/inet_addr.h>
#ifdef HAVE_ARPA_INET_H
#include <arpa/inet.h>
#include <arpa/inet.h>
#endif
#ifdef HAVE_IFADDRS_H
#include <ifaddrs.h>
#include <ifaddrs.h>
#endif
GSList *local_interfaces_to_list(void)
{
GSList *interfaces = NULL;
GSList *interfaces = NULL;
#ifdef HAVE_GETIFADDRS
struct ifaddrs *ifap;
struct ifaddrs *ifa;
int family;
char ip[INET6_ADDRSTRLEN];
struct ifaddrs *ifap;
struct ifaddrs *ifa;
int family;
char ip[INET6_ADDRSTRLEN];
if (getifaddrs(&ifap)) {
goto end;
}
if (getifaddrs(&ifap)) {
goto end;
}
interfaces = g_slist_alloc();
interfaces = g_slist_alloc();
for (ifa = ifap; ifa != NULL; ifa = ifa->ifa_next) {
if (ifa->ifa_addr == NULL)
continue;
for (ifa = ifap; ifa != NULL; ifa = ifa->ifa_next) {
if (ifa->ifa_addr == NULL)
continue;
family = ifa->ifa_addr->sa_family;
family = ifa->ifa_addr->sa_family;
memset(ip, 0x0, INET6_ADDRSTRLEN);
memset(ip, 0x0, INET6_ADDRSTRLEN);
switch (family) {
case AF_INET:
{
struct sockaddr_in *addr4 = (struct sockaddr_in *)ifa->ifa_addr;
ws_inet_ntop4(&addr4->sin_addr, ip, sizeof(ip));
break;
}
case AF_INET6:
{
struct sockaddr_in6 *addr6 = (struct sockaddr_in6 *)ifa->ifa_addr;
ws_inet_ntop6(&addr6->sin6_addr, ip, sizeof(ip));
break;
}
default:
break;
switch (family) {
case AF_INET:
{
struct sockaddr_in *addr4 = (struct sockaddr_in *)ifa->ifa_addr;
ws_inet_ntop4(&addr4->sin_addr, ip, sizeof(ip));
break;
}
/* skip loopback addresses */
if (!g_strcmp0(ip, "127.0.0.1") || !g_strcmp0(ip, "::1"))
continue;
if (*ip) {
interfaces = g_slist_prepend(interfaces, g_strdup(ip));
case AF_INET6:
{
struct sockaddr_in6 *addr6 = (struct sockaddr_in6 *)ifa->ifa_addr;
ws_inet_ntop6(&addr6->sin6_addr, ip, sizeof(ip));
break;
}
default:
break;
}
/* skip loopback addresses */
if (!g_strcmp0(ip, "127.0.0.1") || !g_strcmp0(ip, "::1"))
continue;
if (*ip) {
interfaces = g_slist_prepend(interfaces, g_strdup(ip));
}
}
end:
#endif /* HAVE_GETIFADDRS */
return interfaces;
return interfaces;
}
/*
@ -97,10 +97,10 @@ end:
*
* Local variables:
* c-basic-offset: 4
* tab-width: 4
* tab-width: 8
* indent-tabs-mode: t
* End:
*
* vi: set shiftwidth=4 tabstop=4 noexpandtab:
* :indentSize=4:tabSize=4:noTabs=false:
* vi: set shiftwidth=4 tabstop=8 noexpandtab:
* :indentSize=4:tabSize=8:noTabs=false:
*/