summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2000-01-16 11:18:04 +0000
committerAndrew Tridgell <tridge@samba.org>2000-01-16 11:18:04 +0000
commitb3b634ff4251cca647e1e545fe1e4160736d96b9 (patch)
tree4980f28cca8a5037471aa0db2329bff5f2877763
parent54e1176ba17eaaba82254e4b629fa135802cec10 (diff)
downloadsamba-b3b634ff4251cca647e1e545fe1e4160736d96b9.tar.gz
samba-b3b634ff4251cca647e1e545fe1e4160736d96b9.tar.bz2
samba-b3b634ff4251cca647e1e545fe1e4160736d96b9.zip
use string_set() instead of string_init()
bug pointed out by Richard (This used to be commit 070f49397ff24e4d6ba7c2c1cfaef2dfa0944bd0)
-rw-r--r--source3/param/loadparm.c62
-rw-r--r--source3/smbd/conn.c8
-rw-r--r--source3/smbd/files.c2
3 files changed, 31 insertions, 41 deletions
diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c
index eb981fb5d2..1ae3ca88df 100644
--- a/source3/param/loadparm.c
+++ b/source3/param/loadparm.c
@@ -878,7 +878,7 @@ static void init_globals(void)
if ((parm_table[i].type == P_STRING ||
parm_table[i].type == P_USTRING) &&
parm_table[i].ptr)
- string_init(parm_table[i].ptr,"");
+ string_set(parm_table[i].ptr,"");
string_set(&sDefault.szGuestaccount, GUEST_ACCOUNT);
string_set(&sDefault.szPrinterDriver, "NULL");
@@ -1047,16 +1047,6 @@ static void init_globals(void)
}
/***************************************************************************
-check if a string is initialised and if not then initialise it
-***************************************************************************/
-static void string_initial(char **s,char *v)
-{
- if (!*s || !**s)
- string_init(s,v);
-}
-
-
-/***************************************************************************
Initialise the sDefault parameter structure.
***************************************************************************/
static void init_locals(void)
@@ -1068,47 +1058,47 @@ static void init_locals(void)
case PRINT_AIX:
case PRINT_LPRNG:
case PRINT_PLP:
- string_initial(&sDefault.szLpqcommand,"lpq -P%p");
- string_initial(&sDefault.szLprmcommand,"lprm -P%p %j");
- string_initial(&sDefault.szPrintcommand,"lpr -r -P%p %s");
+ string_set(&sDefault.szLpqcommand,"lpq -P%p");
+ string_set(&sDefault.szLprmcommand,"lprm -P%p %j");
+ string_set(&sDefault.szPrintcommand,"lpr -r -P%p %s");
break;
case PRINT_CUPS:
- string_initial(&sDefault.szLpqcommand,"/usr/bin/lpstat -o%p");
- string_initial(&sDefault.szLprmcommand,"/usr/bin/cancel %p-%j");
- string_initial(&sDefault.szPrintcommand,"/usr/bin/lp -d%p -oraw %s; rm %s");
- string_initial(&sDefault.szQueuepausecommand, "/usr/bin/disable %p");
- string_initial(&sDefault.szQueueresumecommand, "/usr/bin/enable %p");
+ string_set(&sDefault.szLpqcommand,"/usr/bin/lpstat -o%p");
+ string_set(&sDefault.szLprmcommand,"/usr/bin/cancel %p-%j");
+ string_set(&sDefault.szPrintcommand,"/usr/bin/lp -d%p -oraw %s; rm %s");
+ string_set(&sDefault.szQueuepausecommand, "/usr/bin/disable %p");
+ string_set(&sDefault.szQueueresumecommand, "/usr/bin/enable %p");
break;
case PRINT_SYSV:
case PRINT_HPUX:
- string_initial(&sDefault.szLpqcommand,"lpstat -o%p");
- string_initial(&sDefault.szLprmcommand,"cancel %p-%j");
- string_initial(&sDefault.szPrintcommand,"lp -c -d%p %s; rm %s");
+ string_set(&sDefault.szLpqcommand,"lpstat -o%p");
+ string_set(&sDefault.szLprmcommand,"cancel %p-%j");
+ string_set(&sDefault.szPrintcommand,"lp -c -d%p %s; rm %s");
#ifdef HPUX
- string_initial(&sDefault.szQueuepausecommand, "disable %p");
- string_initial(&sDefault.szQueueresumecommand, "enable %p");
+ string_set(&sDefault.szQueuepausecommand, "disable %p");
+ string_set(&sDefault.szQueueresumecommand, "enable %p");
#else /* SYSV */
- string_initial(&sDefault.szLppausecommand,"lp -i %p-%j -H hold");
- string_initial(&sDefault.szLpresumecommand,"lp -i %p-%j -H resume");
- string_initial(&sDefault.szQueuepausecommand, "lpc stop %p");
- string_initial(&sDefault.szQueueresumecommand, "lpc start %p");
+ string_set(&sDefault.szLppausecommand,"lp -i %p-%j -H hold");
+ string_set(&sDefault.szLpresumecommand,"lp -i %p-%j -H resume");
+ string_set(&sDefault.szQueuepausecommand, "lpc stop %p");
+ string_set(&sDefault.szQueueresumecommand, "lpc start %p");
#endif /* SYSV */
break;
case PRINT_QNX:
- string_initial(&sDefault.szLpqcommand,"lpq -P%p");
- string_initial(&sDefault.szLprmcommand,"lprm -P%p %j");
- string_initial(&sDefault.szPrintcommand,"lp -r -P%p %s");
+ string_set(&sDefault.szLpqcommand,"lpq -P%p");
+ string_set(&sDefault.szLprmcommand,"lprm -P%p %j");
+ string_set(&sDefault.szPrintcommand,"lp -r -P%p %s");
break;
case PRINT_SOFTQ:
- string_initial(&sDefault.szLpqcommand,"qstat -l -d%p");
- string_initial(&sDefault.szLprmcommand,"qstat -s -j%j -c");
- string_initial(&sDefault.szPrintcommand,"lp -d%p -s %s; rm %s");
- string_initial(&sDefault.szLppausecommand,"qstat -s -j%j -h");
- string_initial(&sDefault.szLpresumecommand,"qstat -s -j%j -r");
+ string_set(&sDefault.szLpqcommand,"qstat -l -d%p");
+ string_set(&sDefault.szLprmcommand,"qstat -s -j%j -c");
+ string_set(&sDefault.szPrintcommand,"lp -d%p -s %s; rm %s");
+ string_set(&sDefault.szLppausecommand,"qstat -s -j%j -h");
+ string_set(&sDefault.szLpresumecommand,"qstat -s -j%j -r");
break;
}
diff --git a/source3/smbd/conn.c b/source3/smbd/conn.c
index 5dc904bd91..83289b2184 100644
--- a/source3/smbd/conn.c
+++ b/source3/smbd/conn.c
@@ -115,10 +115,10 @@ connection_struct *conn_new(void)
num_open++;
- string_init(&conn->user,"");
- string_init(&conn->dirpath,"");
- string_init(&conn->connectpath,"");
- string_init(&conn->origpath,"");
+ string_set(&conn->user,"");
+ string_set(&conn->dirpath,"");
+ string_set(&conn->connectpath,"");
+ string_set(&conn->origpath,"");
DLIST_ADD(Connections, conn);
diff --git a/source3/smbd/files.c b/source3/smbd/files.c
index d6203580cf..dd1f7037f6 100644
--- a/source3/smbd/files.c
+++ b/source3/smbd/files.c
@@ -97,7 +97,7 @@ files_struct *file_new(void )
files_used++;
fsp->fnum = i + FILE_HANDLE_OFFSET;
- string_init(&fsp->fsp_name,"");
+ string_set(&fsp->fsp_name,"");
DLIST_ADD(Files, fsp);