Displaying 3 results from an estimated 3 matches for "get_extension".
2004 Nov 29
1
Polycom Reboot Script PRI errors!!
...les
$arp = '/sbin/arp'; # Location of arp command
$sipserver = '192.168.XXX.XXX'; # IP of asterisk server
$phone = shift;
checkphone("$phone");
touch( arp2config("$phone") );
reboot_sip_phone( "$phone", "$sipserver", get_extension($phone) );
sub checkphone { # Checks for existence of phone,
makes sure
# it's in arp table
$activephone = shift;
# Populate ARP table
print "Checking ARP table.\n";
$p = Net::Ping->new("icmp");
if ( $p->ping( $a...
2012 Apr 17
2
[GIT PULL] elflink warning fixes and auto extension support
...len(ext->name);
+
+ if (!strncmp(kernel + len - elen, ext->name, elen))
+ return ext->type;
}
+
/* use KT_KERNEL as default */
- else
- type = KT_KERNEL;
+ return KT_KERNEL;
+}
+
+/*
+ * Returns the kernel name with file extension if one wasn't present.
+ */
+static const char *get_extension(const char *kernel)
+{
+ const struct file_ext *ext;
+ const char *p;
+ int len;
+
+ /* Find the end of the command */
+ p = find_command(kernel);
+ len = p - kernel;
+
+ for (ext = file_extensions; ext->name; ext++) {
+ char *str;
+ int elen = strlen(ext->name);
+ int fd;
+
+ str = mallo...
2012 Aug 14
1
[GIT PULL] elflink fixes
...xt *ext;
const char *p;
@@ -62,8 +63,8 @@ enum kernel_type parse_kernel_type(const char *kernel)
return ext->type;
}
- /* use KT_KERNEL as default */
- return KT_KERNEL;
+ /* use IMAGE_TYPE_KERNEL as default */
+ return IMAGE_TYPE_KERNEL;
}
/*
@@ -82,19 +83,20 @@ static const char *get_extension(const char *kernel)
for (ext = file_extensions; ext->name; ext++) {
char *str;
int elen = strlen(ext->name);
- int fd;
+ FILE *f;
str = malloc(len + elen + 1);
strncpy(str, kernel, len);
strncpy(str + len, ext->name, elen);
str[len + elen] = '\0';
-
- fd...