Subversion Repositories SvarDOS

Rev

Rev 712 | Rev 875 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 712 Rev 725
Line 38... Line 38...
38
#include "svarlang.lib\svarlang.h"
38
#include "svarlang.lib\svarlang.h"
39
 
39
 
40
#include "../../pkg/trunk/lsm.h"
40
#include "../../pkg/trunk/lsm.h"
41
 
41
 
42
 
42
 
43
#define PVER "20220215"
43
#define PVER "20220216"
44
#define PDATE "2021-2022"
44
#define PDATE "2021-2022"
45
 
45
 
46
#define HOSTADDR "svardos.org"
46
#define HOSTADDR "svardos.org"
47
 
47
 
48
 
48
 
Line 94... Line 94...
94
 
94
 
95
 
95
 
96
/* parses command line arguments and fills outfname and url accordingly
96
/* parses command line arguments and fills outfname and url accordingly
97
 * returns 0 on success, non-zero otherwise */
97
 * returns 0 on success, non-zero otherwise */
98
static int parseargv(int argc, char * const *argv, char *outfname, char *url, int *ispost) {
98
static int parseargv(int argc, char * const *argv, char *outfname, char *url, int *ispost) {
-
 
99
  const char *lang = getenv("LANG");
-
 
100
  if (lang == NULL) lang = "";
99
  *outfname = 0;
101
  *outfname = 0;
100
  *url = 0;
102
  *url = 0;
101
  *ispost = 0;
103
  *ispost = 0;
102
  if ((argc == 3) && (strcasecmp(argv[1], "search") == 0)) {
104
  if ((argc == 3) && (strcasecmp(argv[1], "search") == 0)) {
103
    sprintf(url, "/repo/?a=search&p=%s", argv[2]);
105
    sprintf(url, "/repo/?a=search&p=%s&lang=%s", argv[2], lang);
104
  } else if ((argc == 3) && (strcasecmp(argv[1], "pull") == 0)) {
106
  } else if ((argc == 3) && (strcasecmp(argv[1], "pull") == 0)) {
105
    unsigned short i;
107
    unsigned short i;
106
    sprintf(url, "/repo/?a=pull&p=%s", argv[2]);
108
    sprintf(url, "/repo/?a=pull&p=%s&lang=%s", argv[2], lang);
107
    /* copy argv[2] into outfname, but stop at first '-' or null terminator
109
    /* copy argv[2] into outfname, but stop at first '-' or null terminator
108
     * this trims any '-version' part in filename to respect 8+3 */
110
     * this trims any '-version' part in filename to respect 8+3 */
109
    for (i = 0; (argv[2][i] != 0) && (argv[2][i] != '-') && (i < 8); i++) {
111
    for (i = 0; (argv[2][i] != 0) && (argv[2][i] != '-') && (i < 8); i++) {
110
      outfname[i] = argv[2][i];
112
      outfname[i] = argv[2][i];
111
    }
113
    }
112
    /* add the svp extension to filename */
114
    /* add the svp extension to filename */
113
    strcpy(outfname + i, ".svp");
115
    strcpy(outfname + i, ".svp");
114
  } else if ((argc == 2) && (strcasecmp(argv[1], "checkup") == 0)) {
116
  } else if ((argc == 2) && (strcasecmp(argv[1], "checkup") == 0)) {
115
    sprintf(url, "/repo/?a=checkup");
117
    sprintf(url, "/repo/?a=checkup&lang=%s", lang);
116
    *ispost = 1;
118
    *ispost = 1;
117
  } else {
119
  } else {
118
    help();
120
    help();
119
    return(-1);
121
    return(-1);
120
  }
122
  }