Annotation of OpenXM/src/util/test.c, Revision 1.8
1.8 ! takayama 1: /* $OpenXM: OpenXM/src/util/test.c,v 1.7 2004/08/12 12:11:41 takayama Exp $ */
1.1 takayama 2: #include <stdio.h>
3: #include "ox_pathfinder.h"
4:
5: sGC_malloc(int a) {
1.8 ! takayama 6: // return GC_malloc(a);
! 7: return malloc(a);
1.1 takayama 8: }
9:
1.7 takayama 10: main() {
1.8 ! takayama 11: main_3();
! 12: }
! 13: // getFieSize is for main_3
! 14: #include <sys/stat.h>
! 15: static int getFileSize(char *s) {
! 16: struct stat buf;
! 17: int m;
! 18: if (s == NULL) return -1;
! 19: m = stat(s,&buf);
! 20: if (m == -1) {
! 21: return -1;
! 22: /* fail */
! 23: }else{
! 24: /* success */
! 25: return (int) buf.st_size;
! 26: }
! 27: }
! 28: main_3() {
! 29: int m;
! 30: m=getFileSize("/cygdrive/c/windows/system32/cmd.exe");
! 31: printf("m=%d\n",m);
! 32: }
! 33: main_2() {
1.7 takayama 34: int n;
35: /*
36: n = oxpSendStringAsFile((char *)getenv("USER"),
37: "localhost", "t.t", "test\n");
38: */
39: n = oxpSendStringAsFile("taka",
40: "lemon2.math.kobe-u.ac.jp", "t.t", "test\n");
41: printf("%d\n",n);
42: }
1.1 takayama 43: /* which command */
1.7 takayama 44: main_1(int argc,char *argv[]) {
1.4 takayama 45: char *s;
1.6 takayama 46: char **a;
47: int i;
48:
49: printf("hello\n"); fflush(NULL);
50: a = getServerEnv("bin/ox_sm1");
51: i = 0;
52: if (a == NULL) {fprintf(stderr,"Not found.\n"); exit(10);}
53: while (a[i] != NULL) {
54: printf("i=%d, %s\n",i,a[i++]);
55: }
56: exit(0);
57:
1.1 takayama 58: if (argc != 2) {
1.5 takayama 59: fprintf(stderr,"test cmdname\n\n");
1.1 takayama 60: }
1.5 takayama 61: printf("%s\n",generateTMPfileName2("hoge","poly",0,0));
62: printf("%s\n",generateTMPfileName2("hoge","poly",1,0));
63: printf("%s\n",generateTMPfileName2("hoge","poly",0,1));
64: printf("%s\n",generateTMPfileName2("hoge","poly",1,1));
65: printf("---------------- getCommandPath ----------------\n");
1.1 takayama 66: printf("%s\n",getCommandPath(argv[1]));
1.3 takayama 67:
68: printf("%s (cyg) ==> %s (win)\n",argv[1],cygwinPathToWinPath(argv[1]));
69: printf("%s (win) ==> %s (cyg)\n",argv[1],winPathToCygwinPath(argv[1]));
1.4 takayama 70:
71: printf("------------------ oxEvalEnvVar ---------------\n");
72: s = "/hoge/afo:${PATH}";
73: printf("%s ==> %s\n",s,oxEvalEnvVar(s));
74: s = "${PATH}:/hoge/afo";
75: printf("%s ==> %s\n",s,oxEvalEnvVar(s));
76: s = "/hoge/afo:${PATH";
77: printf("%s ==> %s\n",s,oxEvalEnvVar(s));
78: s = "/hoge/afo:$PATH}";
79: printf("%s ==> %s\n",s,oxEvalEnvVar(s));
80: s = "${HOME}:${PATH}:/hoge/afo";
81: printf("%s ==> %s\n",s,oxEvalEnvVar(s));
1.1 takayama 82: }
83:
84:
85:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>