strip trailing / from download urls
[15.05/openwrt.git] / target / utils / src / trx.c
index a7a2a54..787ffa8 100644 (file)
 #include <string.h>
 #include <errno.h>
 #include <unistd.h>
-#if defined(__APPLE__)
-#include        <machine/endian.h>
-#include        <machine/byte_order.h>
-#define __BYTE_ORDER BYTE_ORDER
-#define __BIG_ENDIAN BIG_ENDIAN
-#define bswap_16(x) NXSwapShort(x)
-#define bswap_32(x) NXSwapInt(x)
-#define bswap_64(x) NXSwapLongLong(x)
-#else
-#include <endian.h>
-#include <byteswap.h>
-#endif
 
 #if __BYTE_ORDER == __BIG_ENDIAN
 #define STORE32_LE(X)          bswap_32(X)
@@ -89,7 +77,7 @@ void usage(void) __attribute__ (( __noreturn__ ));
 
 void usage(void)
 {
-       fprintf(stderr, "Usage: trx [-o outfile] [-m maxlen] [-a align] [-b offset] file [file [file]]\n");
+       fprintf(stderr, "Usage: trx [-o outfile] [-m maxlen] [-a align] [-b offset] [-f file] [-f file [-f file]]\n");
        exit(EXIT_FAILURE);
 }
 
@@ -122,8 +110,9 @@ int main(int argc, char **argv)
        in = NULL;
        i = 0;
 
-       while ((c = getopt(argc, argv, "-:o:m:a:b:")) != -1) {
+       while ((c = getopt(argc, argv, "-:o:m:a:b:f:")) != -1) {
                switch (c) {
+                       case 'f':
                        case 1:
                                p->offsets[i++] = STORE32_LE(cur_len);