|
|
@ -0,0 +1,44 @@ |
|
|
|
/* |
|
|
|
* --- SDE-COPYRIGHT-NOTE-BEGIN --- |
|
|
|
* This copyright note is auto-generated by ./scripts/Create-CopyPatch. |
|
|
|
* |
|
|
|
* Filename: src/tools-source/versionsort.c |
|
|
|
* Copyright (C) 2009 The OpenSDE Project |
|
|
|
* |
|
|
|
* More information can be found in the files COPYING and README. |
|
|
|
* |
|
|
|
* This program is free software; you can redistribute it and/or modify |
|
|
|
* it under the terms of the GNU General Public License as published by |
|
|
|
* the Free Software Foundation; version 2 of the License. A copy of the |
|
|
|
* GNU General Public License can be found in the file COPYING. |
|
|
|
* --- SDE-COPYRIGHT-NOTE-END --- |
|
|
|
*/ |
|
|
|
|
|
|
|
#define _GNU_SOURCE |
|
|
|
#include <string.h> |
|
|
|
#include <stdio.h> |
|
|
|
|
|
|
|
#include <stdlib.h> |
|
|
|
|
|
|
|
static int cmp_version(const void *p1, const void *p2) { |
|
|
|
const char **s1=(const char **)p1; |
|
|
|
const char **s2=(const char **)p2; |
|
|
|
|
|
|
|
return strverscmp(*s1, *s2); |
|
|
|
} |
|
|
|
|
|
|
|
int main(int argc, char **argv) { |
|
|
|
register unsigned i; |
|
|
|
|
|
|
|
if (argc == 1 || strcmp(argv[1],"-?") == 0) { |
|
|
|
fprintf(stderr, "Usage: %s <s1> <s2> ..\n", argv[0]); |
|
|
|
return EXIT_FAILURE; |
|
|
|
} |
|
|
|
|
|
|
|
qsort(&argv[1], argc-1, sizeof(argv[0]), cmp_version); |
|
|
|
|
|
|
|
for (i=1; i<(unsigned)argc; i++) |
|
|
|
printf("%s\n", argv[i]); |
|
|
|
|
|
|
|
return EXIT_SUCCESS; |
|
|
|
} |