From: | Edwin Quijada <listas_quijada(at)hotmail(dot)com> |
---|---|
To: | <reingart(at)gmail(dot)com> |
Cc: | <alvherre(at)commandprompt(dot)com>, <pgsql-es-ayuda(at)postgresql(dot)org> |
Subject: | RE: compilando en windows con Mingw |
Date: | 2010-08-28 19:08:35 |
Message-ID: | BAY155-w4019D438D622198A4D2111E3870@phx.gbl |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-es-ayuda |
Este es el codigo de la funcion:;
#include <stdio.h>
#include <string.h>
#include "postgres.h"
#include <string.h>
#include "fmgr.h"
#include "libstd.h"
#define LENMAX 100
#ifdef PG_MODULE_MAGIC
PG_MODULE_MAGIC;
#endif
PG_FUNCTION_INFO_V1(pg_serverid);
Datum
pg_serverid(PG_FUNCTION_ARGS)
{ FILE *fp;
char buffer[80],mac[20];
int i,j;
char *line="Physical Address";
text *new_t = (text *) palloc(30);
system("ipconfig /all > ww.txt");
fp=fopen("ww.txt","r+");
while (!feof(fp))
{fgets(buffer,79,fp);
if (strstr(buffer,line)!=NULL) break;
}
//inicio = strpos(buffer,':');
for (i=strpos(buffer,':')+1,j=0;i<strlen(buffer);i++)
if ((buffer[i]>='0' && buffer[i]<='9') || (buffer[i]>='A' && buffer[i]<='F') || (buffer[i]=='-'))
{ mac[j]=buffer[i];j++; }
//
mac[j]=0;
fclose(fp);
system("del ww.txt");
//
SET_VARSIZE(new_t, strlen(mac) + VARHDRSZ);
memcpy(VARDATA(new_t),mac,strlen(mac));
PG_RETURN_TEXT_P(new_t);
}
*-------------------------------------------------------*
*-Edwin Quijada
*-Developer DataBase
*-JQ Microsistemas
*-Soporte PostgreSQL
*-www.jqmicrosistemas.com
*-809-849-8087
*-------------------------------------------------------*
From | Date | Subject | |
---|---|---|---|
Next Message | Diego Schulz | 2010-08-28 19:41:20 | Re: Moviendo una gran base de datos |
Previous Message | Martin Li Causi | 2010-08-28 16:15:38 | Re: log_min_duration_statement |