summaryrefslogtreecommitdiff
path: root/source3/lib
diff options
context:
space:
mode:
authorLuke Leighton <lkcl@samba.org>1997-11-02 20:35:20 +0000
committerLuke Leighton <lkcl@samba.org>1997-11-02 20:35:20 +0000
commitb26623bc3a8ff5191763c83564453e77edee836a (patch)
treef42de0e6b960e98492a2b9127796964fb5aee681 /source3/lib
parent73b47876242071af7077df7089aa28d5e9ca911f (diff)
downloadsamba-b26623bc3a8ff5191763c83564453e77edee836a.tar.gz
samba-b26623bc3a8ff5191763c83564453e77edee836a.tar.bz2
samba-b26623bc3a8ff5191763c83564453e77edee836a.zip
Christian Lademann's contribution: new capabilities in smb.conf.
'<' and '|' characters indicate read file and execute command respectively, and feed the output into the parameter (!!!). '<$' and '|$' means run standard_sub_basic() on them. this is going to be fun to document in smb.conf.5.... also, Christian created a new "online" service parameter. services can be taken "off-line".... (This used to be commit 15f44d28916cdc1432bffdbb999c7cf7efd8fb86)
Diffstat (limited to 'source3/lib')
-rw-r--r--source3/lib/util.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/source3/lib/util.c b/source3/lib/util.c
index 4d098013f2..9ee9bbab1c 100644
--- a/source3/lib/util.c
+++ b/source3/lib/util.c
@@ -4561,3 +4561,44 @@ char *tab_depth(int depth)
}
+/*******************************************************************
+A convenience routine to grab string parameters into a rotating
+buffer. The buffers can be written to by callers without affecting
+the source string.
+********************************************************************/
+char *string_buffer(int sz)
+{
+ static char *bufs[10];
+ static int buflen[10];
+ static int next = -1;
+ char *ret;
+ int i, len;
+
+ if (next == -1) {
+ /* initialisation */
+ for (i=0;i<10;i++) {
+ bufs[i] = NULL;
+ buflen[i] = 0;
+ }
+ next = 0;
+ }
+
+ len = MAX(sz+100,sizeof(pstring)); /* the +100 is for some
+ substitution room */
+
+ if (buflen[next] != len) {
+ buflen[next] = len;
+ if (bufs[next]) free(bufs[next]);
+ bufs[next] = (char *)malloc(len);
+ if (!bufs[next]) {
+ DEBUG(0,("out of memory in lp_string_buffer()"));
+ exit(1);
+ }
+ }
+
+ ret = &bufs[next][0];
+ next = (next+1)%10;
+ *ret = 0;
+
+ return(ret);
+}