summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2009-05-29 15:10:28 -0700
committerH. Peter Anvin <hpa@zytor.com>2009-05-29 15:10:28 -0700
commit89a0b07e72f342bcd7429ac482d52cacaad13e4b (patch)
tree4a10ae6168198d12d230535d060d14d6b197bf19
parent6a08ded71aa7adf2ff0b6dbabef3dbdedd3dc6d8 (diff)
downloadsyslinux-89a0b07e72f342bcd7429ac482d52cacaad13e4b.tar.gz
Run Nindent on com32/modules/ethersel.c
Automatically reformat com32/modules/ethersel.c using Nindent. Do this for all files except HDT, gPXE and externally maintained libraries (zlib, tinyjpeg, libpng). Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-rw-r--r--com32/modules/ethersel.c252
1 files changed, 125 insertions, 127 deletions
diff --git a/com32/modules/ethersel.c b/com32/modules/ethersel.c
index 9bd445c0..f586e836 100644
--- a/com32/modules/ethersel.c
+++ b/com32/modules/ethersel.c
@@ -44,13 +44,12 @@
# define dprintf(...) ((void)0)
#endif
-static char *
-skipspace(char *p)
+static char *skipspace(char *p)
{
- while ( *p && *p <= ' ' )
- p++;
+ while (*p && *p <= ' ')
+ p++;
- return p;
+ return p;
}
#define MAX_LINE 512
@@ -58,155 +57,154 @@ skipspace(char *p)
/* Check to see if we are at a certain keyword (case insensitive) */
static int looking_at(const char *line, const char *kwd)
{
- const char *p = line;
- const char *q = kwd;
+ const char *p = line;
+ const char *q = kwd;
- while ( *p && *q && ((*p^*q) & ~0x20) == 0 ) {
- p++;
- q++;
- }
+ while (*p && *q && ((*p ^ *q) & ~0x20) == 0) {
+ p++;
+ q++;
+ }
- if ( *q )
- return 0; /* Didn't see the keyword */
+ if (*q)
+ return 0; /* Didn't see the keyword */
- return *p <= ' '; /* Must be EOL or whitespace */
+ return *p <= ' '; /* Must be EOL or whitespace */
}
-static char *
-get_did(char *p, uint32_t *idptr, uint32_t *maskptr)
+static char *get_did(char *p, uint32_t * idptr, uint32_t * maskptr)
{
- unsigned long vid, did, m1, m2;
-
- *idptr = -1;
- *maskptr = 0xffffffff;
-
- vid = strtoul(p, &p, 16);
- if ( *p != ':' )
- return p; /* Bogus ID */
- did = strtoul(p+1, &p, 16);
-
- *idptr = (did << 16) + vid;
-
- if ( *p == '/' ) {
- m1 = strtoul(p+1, &p, 16);
- if ( *p != ':' ) {
- *maskptr = (m1 << 16) | 0xffff;
- } else {
- m2 = strtoul(p+1, &p, 16);
- *maskptr = (m1 << 16) | m2;
+ unsigned long vid, did, m1, m2;
+
+ *idptr = -1;
+ *maskptr = 0xffffffff;
+
+ vid = strtoul(p, &p, 16);
+ if (*p != ':')
+ return p; /* Bogus ID */
+ did = strtoul(p + 1, &p, 16);
+
+ *idptr = (did << 16) + vid;
+
+ if (*p == '/') {
+ m1 = strtoul(p + 1, &p, 16);
+ if (*p != ':') {
+ *maskptr = (m1 << 16) | 0xffff;
+ } else {
+ m2 = strtoul(p + 1, &p, 16);
+ *maskptr = (m1 << 16) | m2;
+ }
}
- }
- return p;
+ return p;
}
-static char *
-get_rid_range(char *p, uint8_t *rid_min, uint8_t *rid_max)
+static char *get_rid_range(char *p, uint8_t * rid_min, uint8_t * rid_max)
{
- unsigned long r0, r1;
+ unsigned long r0, r1;
- p = skipspace(p+3);
+ p = skipspace(p + 3);
- r0 = strtoul(p, &p, 16);
- if ( *p == '-' ) {
- r1 = strtoul(p+1, &p, 16);
- } else {
- r1 = r0;
- }
+ r0 = strtoul(p, &p, 16);
+ if (*p == '-') {
+ r1 = strtoul(p + 1, &p, 16);
+ } else {
+ r1 = r0;
+ }
- *rid_min = r0;
- *rid_max = r1;
+ *rid_min = r0;
+ *rid_max = r1;
- return p;
+ return p;
}
-static struct match *
-parse_config(const char *filename)
+static struct match *parse_config(const char *filename)
{
- char line[MAX_LINE], *p;
- FILE *f;
- struct match *list = NULL;
- struct match **ep = &list;
- struct match *m;
-
- if ( !filename )
- filename = syslinux_config_file();
-
- f = fopen(filename, "r");
- if ( !f )
- return list;
-
- while ( fgets(line, sizeof line, f) ) {
- p = skipspace(line);
-
- if ( !looking_at(p, "#") )
- continue;
- p = skipspace(p+1);
-
- if ( !looking_at(p, "dev") )
- continue;
- p = skipspace(p+3);
-
- m = malloc(sizeof(struct match));
- if ( !m )
- continue;
-
- memset(m, 0, sizeof *m);
- m->rid_max = 0xff;
-
- for(;;) {
- p = skipspace(p);
-
- if ( looking_at(p, "did") ) {
- p = get_did(p+3, &m->did, &m->did_mask);
- } else if ( looking_at(p, "sid") ) {
- p = get_did(p+3, &m->sid, &m->sid_mask);
- } else if ( looking_at(p, "rid") ) {
- p = get_rid_range(p+3, &m->rid_min, &m->rid_max);
- } else {
- char *e;
-
- e = strchr(p, '\n');
- if ( *e ) *e = '\0';
- e = strchr(p, '\r');
- if ( *e ) *e = '\0';
-
- m->filename = strdup(p);
- if ( !m->filename )
- m->did = -1;
- break; /* Done with this line */
- }
+ char line[MAX_LINE], *p;
+ FILE *f;
+ struct match *list = NULL;
+ struct match **ep = &list;
+ struct match *m;
+
+ if (!filename)
+ filename = syslinux_config_file();
+
+ f = fopen(filename, "r");
+ if (!f)
+ return list;
+
+ while (fgets(line, sizeof line, f)) {
+ p = skipspace(line);
+
+ if (!looking_at(p, "#"))
+ continue;
+ p = skipspace(p + 1);
+
+ if (!looking_at(p, "dev"))
+ continue;
+ p = skipspace(p + 3);
+
+ m = malloc(sizeof(struct match));
+ if (!m)
+ continue;
+
+ memset(m, 0, sizeof *m);
+ m->rid_max = 0xff;
+
+ for (;;) {
+ p = skipspace(p);
+
+ if (looking_at(p, "did")) {
+ p = get_did(p + 3, &m->did, &m->did_mask);
+ } else if (looking_at(p, "sid")) {
+ p = get_did(p + 3, &m->sid, &m->sid_mask);
+ } else if (looking_at(p, "rid")) {
+ p = get_rid_range(p + 3, &m->rid_min, &m->rid_max);
+ } else {
+ char *e;
+
+ e = strchr(p, '\n');
+ if (*e)
+ *e = '\0';
+ e = strchr(p, '\r');
+ if (*e)
+ *e = '\0';
+
+ m->filename = strdup(p);
+ if (!m->filename)
+ m->did = -1;
+ break; /* Done with this line */
+ }
+ }
+
+ dprintf("DEV DID %08x/%08x SID %08x/%08x RID %02x-%02x CMD %s\n",
+ m->did, m->did_mask, m->sid, m->sid_mask,
+ m->rid_min, m->rid_max, m->filename);
+
+ *ep = m;
+ ep = &m->next;
}
- dprintf("DEV DID %08x/%08x SID %08x/%08x RID %02x-%02x CMD %s\n",
- m->did, m->did_mask, m->sid, m->sid_mask,
- m->rid_min, m->rid_max, m->filename);
-
- *ep = m;
- ep = &m->next;
- }
-
- return list;
+ return list;
}
int main(int argc, char *argv[])
{
- struct match *list, *match;
- struct pci_domain *pci_domain;
+ struct match *list, *match;
+ struct pci_domain *pci_domain;
- openconsole(&dev_null_r, &dev_stdcon_w);
- pci_domain = pci_scan();
+ openconsole(&dev_null_r, &dev_stdcon_w);
+ pci_domain = pci_scan();
- if (pci_domain) {
- list = parse_config(argc < 2 ? NULL : argv[1]);
+ if (pci_domain) {
+ list = parse_config(argc < 2 ? NULL : argv[1]);
- match = find_pci_device(pci_domain, list);
+ match = find_pci_device(pci_domain, list);
- if ( match )
- syslinux_run_command(match->filename);
- }
+ if (match)
+ syslinux_run_command(match->filename);
+ }
- /* On error, return to the command line */
- fputs("Error: no recognized network card found!\n", stderr);
- return 1;
+ /* On error, return to the command line */
+ fputs("Error: no recognized network card found!\n", stderr);
+ return 1;
}